Led blinking in the other way: Blink the green LED by switching the LED_GREEN (PTB19) pin between output and input mode. In output mode the pin will sink, while in the input mode it will be in the tristate (high impedance) mode. Platform: RDM-KL25Z board
Dependencies: mbed
main.cpp@0:4e110b1c53fc, 2015-10-12 (annotated)
- Committer:
- icserny
- Date:
- Mon Oct 12 15:41:17 2015 +0000
- Revision:
- 0:4e110b1c53fc
First version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
icserny | 0:4e110b1c53fc | 1 | /** Ledblink the other way |
icserny | 0:4e110b1c53fc | 2 | * Blink the green LED by switching the LED_GREEN (PTB19) pin |
icserny | 0:4e110b1c53fc | 3 | * between output and input mode. In output mode the pin will sink, |
icserny | 0:4e110b1c53fc | 4 | * while in the input mode it will be in the tristate (high impedance) mode. |
icserny | 0:4e110b1c53fc | 5 | * |
icserny | 0:4e110b1c53fc | 6 | * Platform: RDM-KL25Z board |
icserny | 0:4e110b1c53fc | 7 | */ |
icserny | 0:4e110b1c53fc | 8 | |
icserny | 0:4e110b1c53fc | 9 | #include "mbed.h" |
icserny | 0:4e110b1c53fc | 10 | |
icserny | 0:4e110b1c53fc | 11 | DigitalInOut myled(LED_GREEN); |
icserny | 0:4e110b1c53fc | 12 | |
icserny | 0:4e110b1c53fc | 13 | int main() { |
icserny | 0:4e110b1c53fc | 14 | while(1) { |
icserny | 0:4e110b1c53fc | 15 | myled.output(); |
icserny | 0:4e110b1c53fc | 16 | myled = 0; |
icserny | 0:4e110b1c53fc | 17 | wait(0.2); |
icserny | 0:4e110b1c53fc | 18 | myled.input(); |
icserny | 0:4e110b1c53fc | 19 | wait(0.2); |
icserny | 0:4e110b1c53fc | 20 | } |
icserny | 0:4e110b1c53fc | 21 | } |