Skip to content

Commit c9350f8

Browse files
committed
Update ARDUINO test to allow period change
1 parent 7c657ad commit c9350f8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libraries/tests/mbed/pwm/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ float value = 0.75;
1919
int main() {
2020
#if defined(TARGET_FF_ARDUINO)
2121
PwmOut pwm(D9);
22+
int period_us = 40000; // allows to test various periods
2223

23-
pwm.period_ms(10);
24+
pwm.period_us(period_us);
2425
pwm.write(value);
2526

2627
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));
2829

2930
notify_completion(result == value ? true : false);
30-
3131
#elif defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC11U24) || defined(TARGET_LPC4088) || defined(TARGET_LPC2460)
3232
PwmOut pwm_p25(p25);
3333
PwmOut pwm_p26(p26);

0 commit comments

Comments
 (0)