File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -19,15 +19,15 @@ float value = 0.75;
19
19
int main () {
20
20
#if defined(TARGET_FF_ARDUINO)
21
21
PwmOut pwm (D9);
22
+ int period_us = 40000 ; // allows to test various periods
22
23
23
- pwm.period_ms ( 10 );
24
+ pwm.period_us (period_us );
24
25
pwm.write (value);
25
26
26
27
float result = floor (pwm.read () * 100 + 0.5 ) / 100 ; // round it to 0.xx
27
- printf (" Initialize PWM on pin D9 with duty cycle: %.2f \n " , result);
28
+ printf (" PWM period = %dus with duty cycle: %d%% \n " , period_us, ( int ) ( result * 100 ) );
28
29
29
30
notify_completion (result == value ? true : false );
30
-
31
31
#elif defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC11U24) || defined(TARGET_LPC4088) || defined(TARGET_LPC2460)
32
32
PwmOut pwm_p25 (p25);
33
33
PwmOut pwm_p26 (p26);
You can’t perform that action at this time.
0 commit comments