File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
libraries/tests/mbed/pwm_led Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change
1
+ #include " mbed.h"
2
+
3
+ #ifdef TARGET_NUCLEO_F103RB
4
+ PwmOut led (D3);
5
+ #else
6
+ #error This test is not supported on this target.
7
+ #endif
8
+
9
+ int main () {
10
+ float crt = 1.0 , delta = 0.05 ;
11
+
12
+ led.period_ms (2 ); // 500Hz
13
+ while (true ) {
14
+ led.write (crt);
15
+ wait_ms (50 );
16
+ crt = crt + delta;
17
+ if (crt > 1.0 ) {
18
+ crt = 1.0 ;
19
+ delta = -delta;
20
+ }
21
+ else if (crt < 0 ) {
22
+ crt = 0 ;
23
+ delta = -delta;
24
+ }
25
+ }
26
+ }
Original file line number Diff line number Diff line change 408
408
"dependencies" : [MBED_LIBRARIES ],
409
409
"mcu" : ["LPC1768" , "LPC4088" ]
410
410
},
411
-
411
+ {
412
+ "id" : "MBED_31" , "description" : "PWM LED test" ,
413
+ "source_dir" : join (TEST_DIR , "mbed" , "pwm_led" ),
414
+ "dependencies" : [MBED_LIBRARIES ],
415
+ },
416
+
412
417
# CMSIS RTOS tests
413
418
{
414
419
"id" : "CMSIS_RTOS_1" , "description" : "Basic" ,
You can’t perform that action at this time.
0 commit comments