Added LED PWM test

pull/124/merge
Bogdan Marinescu 2013-12-12 16:54:49 +02:00
parent bd51e4eb73
commit 7d1c888204
2 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,26 @@
#include "mbed.h"
#ifdef TARGET_NUCLEO_F103RB
PwmOut led(D3);
#else
#error This test is not supported on this target.
#endif
int main() {
float crt = 1.0, delta = 0.05;
led.period_ms(2); // 500Hz
while (true) {
led.write(crt);
wait_ms(50);
crt = crt + delta;
if (crt > 1.0) {
crt = 1.0;
delta = -delta;
}
else if (crt < 0) {
crt = 0;
delta = -delta;
}
}
}

View File

@ -408,7 +408,12 @@ TESTS = [
"dependencies": [MBED_LIBRARIES],
"mcu": ["LPC1768", "LPC4088"]
},
{
"id": "MBED_31", "description": "PWM LED test",
"source_dir": join(TEST_DIR, "mbed", "pwm_led"),
"dependencies": [MBED_LIBRARIES],
},
# CMSIS RTOS tests
{
"id": "CMSIS_RTOS_1", "description": "Basic",