a led demo code
Dependents: Nucleo_F411RE_OS_Robot_Tank
LED.cpp@2:94318e6e89ff, 2018-06-19 (annotated)
- Committer:
- adaphoto
- Date:
- Tue Jun 19 12:24:06 2018 +0000
- Revision:
- 2:94318e6e89ff
- Parent:
- 1:6cb3a93ae325
??????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
adaphoto | 0:651a5dcc2df6 | 1 | #include "mbed.h" |
adaphoto | 0:651a5dcc2df6 | 2 | #include "LED.h" |
adaphoto | 0:651a5dcc2df6 | 3 | |
adaphoto | 0:651a5dcc2df6 | 4 | LED::LED(PinName ledpin) : led(ledpin) { |
adaphoto | 0:651a5dcc2df6 | 5 | init(); |
adaphoto | 0:651a5dcc2df6 | 6 | } |
adaphoto | 0:651a5dcc2df6 | 7 | |
adaphoto | 0:651a5dcc2df6 | 8 | void LED::init(){ |
adaphoto | 0:651a5dcc2df6 | 9 | led = 0; |
adaphoto | 0:651a5dcc2df6 | 10 | } |
adaphoto | 0:651a5dcc2df6 | 11 | |
adaphoto | 0:651a5dcc2df6 | 12 | void LED::LED_On(){ |
adaphoto | 0:651a5dcc2df6 | 13 | led = 1; |
adaphoto | 0:651a5dcc2df6 | 14 | } |
adaphoto | 0:651a5dcc2df6 | 15 | |
adaphoto | 0:651a5dcc2df6 | 16 | void LED::LED_Off(){ |
adaphoto | 0:651a5dcc2df6 | 17 | led = 0; |
adaphoto | 0:651a5dcc2df6 | 18 | } |
adaphoto | 0:651a5dcc2df6 | 19 | |
adaphoto | 0:651a5dcc2df6 | 20 | void LED::LED_Troggle(){ |
adaphoto | 0:651a5dcc2df6 | 21 | led = !led; |
adaphoto | 1:6cb3a93ae325 | 22 | } |
adaphoto | 1:6cb3a93ae325 | 23 | |
adaphoto | 1:6cb3a93ae325 | 24 |