EasyManuals Logo

Freenove ESP32 User Manual

Default Icon
159 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #92 background imageLoading...
Page #92 background image
Need support? support@freenove.com
90
Chapter 7 Built-in Led
www.freenove.com
BuiltInLed.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "BuiltInLed.h"
uint32_t sqValue = 0b00000101;
uint32_t lastLedUpdateTime = 0;
uint16_t intervalTime = 100; // ms
bool ledStatus = false;
bool lastLedStatus = true;
uint8_t ledRunnigStatus = 0;
void setupBuiltInLed(){
pinMode(LED_BUILT_IN, OUTPUT);
}
void setBuiltInLed(bool state){
digitalWrite(LED_BUILT_IN, state);
}
void task_showBuiltInLed(void *pvParameters){
static uint8_t bitIndex = 0;
static uint8_t bitDiff = 0;
if (millis() - lastLedUpdateTime > intervalTime){
switch (ledRunnigStatus){
case 0: // running
ledStatus = ((sqValue >> bitIndex) & 0x01) ? true : false;
if (ledStatus != lastLedStatus){
digitalWrite(LED_BUILT_IN, (uint8_t)ledStatus);
lastLedStatus = ledStatus;
bitDiff++;
}
bitIndex++;
if (bitIndex >= 10){
intervalTime = 600;
ledRunnigStatus = 1;
bitDiff = 0;
bitIndex = 0;
}
break;
case 1: // off
intervalTime = 100;
ledRunnigStatus = 0;
break;
default:
break;

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Freenove ESP32 and is the answer not in the manual?

Freenove ESP32 Specifications

General IconGeneral
BrandFreenove
ModelESP32
CategoryComputer Hardware
LanguageEnglish

Related product manuals