a led demo code
Dependents: Nucleo_F411RE_OS_Robot_Tank
LED.h@1:6cb3a93ae325, 2018-06-18 (annotated)
- Committer:
- adaphoto
- Date:
- Mon Jun 18 08:57:16 2018 +0000
- Revision:
- 1:6cb3a93ae325
- Parent:
- 0:651a5dcc2df6
- Child:
- 2:94318e6e89ff
update test; use example code update
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
adaphoto | 0:651a5dcc2df6 | 1 | #ifndef LED_H_ADA |
adaphoto | 0:651a5dcc2df6 | 2 | #define LED_H_ADA |
adaphoto | 0:651a5dcc2df6 | 3 | |
adaphoto | 1:6cb3a93ae325 | 4 | /* |
adaphoto | 1:6cb3a93ae325 | 5 | Example of use: |
adaphoto | 1:6cb3a93ae325 | 6 | * @code |
adaphoto | 1:6cb3a93ae325 | 7 | *LED user_led(LED1); |
adaphoto | 1:6cb3a93ae325 | 8 | *int main() |
adaphoto | 1:6cb3a93ae325 | 9 | *{ |
adaphoto | 1:6cb3a93ae325 | 10 | * |
adaphoto | 1:6cb3a93ae325 | 11 | * while (true) |
adaphoto | 1:6cb3a93ae325 | 12 | * { |
adaphoto | 1:6cb3a93ae325 | 13 | * user_led.LED_On(); |
adaphoto | 1:6cb3a93ae325 | 14 | * wait(0.05); |
adaphoto | 1:6cb3a93ae325 | 15 | * user_led.LED_Off(); |
adaphoto | 1:6cb3a93ae325 | 16 | * wait(0.05); |
adaphoto | 1:6cb3a93ae325 | 17 | * } |
adaphoto | 1:6cb3a93ae325 | 18 | *} |
adaphoto | 1:6cb3a93ae325 | 19 | * @code |
adaphoto | 1:6cb3a93ae325 | 20 | */ |
adaphoto | 1:6cb3a93ae325 | 21 | |
adaphoto | 0:651a5dcc2df6 | 22 | class LED |
adaphoto | 0:651a5dcc2df6 | 23 | { |
adaphoto | 0:651a5dcc2df6 | 24 | public: |
adaphoto | 0:651a5dcc2df6 | 25 | LED(PinName ledpin); |
adaphoto | 0:651a5dcc2df6 | 26 | |
adaphoto | 0:651a5dcc2df6 | 27 | void LED_On(); |
adaphoto | 0:651a5dcc2df6 | 28 | |
adaphoto | 0:651a5dcc2df6 | 29 | void LED_Off(); |
adaphoto | 0:651a5dcc2df6 | 30 | |
adaphoto | 0:651a5dcc2df6 | 31 | void LED_Troggle(); |
adaphoto | 0:651a5dcc2df6 | 32 | |
adaphoto | 0:651a5dcc2df6 | 33 | private: |
adaphoto | 0:651a5dcc2df6 | 34 | DigitalOut led; |
adaphoto | 0:651a5dcc2df6 | 35 | /** Initialization. */ |
adaphoto | 0:651a5dcc2df6 | 36 | void init(); |
adaphoto | 0:651a5dcc2df6 | 37 | }; |
adaphoto | 0:651a5dcc2df6 | 38 | |
adaphoto | 0:651a5dcc2df6 | 39 | #endif |