Update ARDUINO test to allow period change

pull/1706/head
Laurent Meunier 2016-05-03 16:31:46 +02:00
parent 7c657ad5c9
commit c9350f8e5a
1 changed files with 3 additions and 3 deletions

View File

@ -19,15 +19,15 @@ float value = 0.75;
int main() {
#if defined(TARGET_FF_ARDUINO)
PwmOut pwm(D9);
int period_us = 40000; // allows to test various periods
pwm.period_ms(10);
pwm.period_us(period_us);
pwm.write(value);
float result = floor(pwm.read() * 100 + 0.5) / 100; // round it to 0.xx
printf("Initialize PWM on pin D9 with duty cycle: %.2f\n", result);
printf("PWM period = %dus with duty cycle: %d%%\n", period_us, (int) (result * 100));
notify_completion(result == value ? true : false);
#elif defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC11U24) || defined(TARGET_LPC4088) || defined(TARGET_LPC2460)
PwmOut pwm_p25(p25);
PwmOut pwm_p26(p26);