Biorobotics_group_2
/
PWM_LED
Adjust the brightness of a LED using potmeter input and FastPWM output
Diff: main.cpp
- Revision:
- 1:db6539dc8ea9
- Parent:
- 0:fe2a62ab1017
--- a/main.cpp Fri Oct 07 09:41:40 2016 +0000 +++ b/main.cpp Fri Oct 07 09:43:52 2016 +0000 @@ -15,8 +15,8 @@ // Initial duty value and period volatile float duty = 0.0; -volatile float frequency = 100.0; -const int Timeset_duty_cycle = 1000; +volatile float frequency_pwm = 100.0; +const int Timeset_duty_cycle = 50; void set_dutycycle() { duty=pot.read(); @@ -35,7 +35,7 @@ tick_set_brightness.attach(set_dutycycle,1/Timeset_duty_cycle); // Set period of LED - led.period(1.0/frequency); + led.period(1.0/frequency_pwm); while(true){