Anoney Potter
/
Nucleo_DigitalInput
Nucleo_DigitalInput
main.cpp@0:e66a2abcf59d, 2015-12-11 (annotated)
- Committer:
- anoney180133
- Date:
- Fri Dec 11 14:20:57 2015 +0000
- Revision:
- 0:e66a2abcf59d
dc
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
anoney180133 | 0:e66a2abcf59d | 1 | #include "mbed.h" |
anoney180133 | 0:e66a2abcf59d | 2 | |
anoney180133 | 0:e66a2abcf59d | 3 | DigitalOut Nucleo_GREEN_LED(LED1); |
anoney180133 | 0:e66a2abcf59d | 4 | DigitalIn Push_Button(PC_13,PullNone); |
anoney180133 | 0:e66a2abcf59d | 5 | |
anoney180133 | 0:e66a2abcf59d | 6 | int main() |
anoney180133 | 0:e66a2abcf59d | 7 | { |
anoney180133 | 0:e66a2abcf59d | 8 | while(1) |
anoney180133 | 0:e66a2abcf59d | 9 | { |
anoney180133 | 0:e66a2abcf59d | 10 | if(Push_Button.read() == 0) // pressed button |
anoney180133 | 0:e66a2abcf59d | 11 | { |
anoney180133 | 0:e66a2abcf59d | 12 | Nucleo_GREEN_LED = 1; // LED is ON |
anoney180133 | 0:e66a2abcf59d | 13 | } |
anoney180133 | 0:e66a2abcf59d | 14 | else |
anoney180133 | 0:e66a2abcf59d | 15 | { |
anoney180133 | 0:e66a2abcf59d | 16 | Nucleo_GREEN_LED = 0; // LED is OFF |
anoney180133 | 0:e66a2abcf59d | 17 | } |
anoney180133 | 0:e66a2abcf59d | 18 | } |
anoney180133 | 0:e66a2abcf59d | 19 | } |