-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlogoPWM.ino
More file actions
41 lines (41 loc) · 990 Bytes
/
logoPWM.ino
File metadata and controls
41 lines (41 loc) · 990 Bytes
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
#ifdef useLedHeartbeat
void manageLogoPWM(void* data)
{
if(millis() - lastLedPwmChange > ledPwmChangeInterval)
{
lastLedPwmChange = millis();
if(ledPwmMaxBrightness == 0)
{
ledcWrite(0, 0);
}
else
{
if(dir)
{
currentPwmBrightness += ledPwmMaxBrightness / 4;
if(currentPwmBrightness >= ledPwmMaxBrightness)
{
currentPwmBrightness = ledPwmMaxBrightness;
dir = false;
}
}
else
{
if(currentPwmBrightness > 0)
{
currentPwmBrightness -= ledPwmMaxBrightness / 32;
}
if(currentPwmBrightness <= 0)
{
currentPwmBrightness = 0;
if(ledPulsing == true)
{
dir = true;
}
}
}
ledcWrite(0, max(0,min(4095, currentPwmBrightness)));
}
}
}
#endif