Flipklok
Loading...
Searching...
No Matches
led.c
Go to the documentation of this file.
1
/*
2
* led.c
3
*
4
* Created on: 21 mrt. 2025
5
*/
6
11
12
#include "
led.h
"
13
#include "
timer.h
"
14
15
unsigned
int
pwmOnCycles
= 0;
16
22
void
changeLedBrightness
(
volatile
unsigned
int
adcReading)
23
{
24
adcReading = adcReading / 32;
// scale from 0-1023 to 0-31
25
adcReading = 33 - adcReading;
// Invert so 32 = 0 and 0 = 32, added one to avoid pwmOnCycles = 0
26
pwmOnCycles
= adcReading;
27
}
led.h
pwmOnCycles
unsigned int pwmOnCycles
Definition
led.c:15
changeLedBrightness
void changeLedBrightness()
timer.h
Code
led.c
Generated by
1.13.2