Rodrigo Lino
/
Nucleo_read_button
sadasd
Fork of Nucleo_read_button by
main.cpp@2:5d81a684944c, 2018-04-24 (annotated)
- Committer:
- digo1234
- Date:
- Tue Apr 24 18:39:05 2018 +0000
- Revision:
- 2:5d81a684944c
- Parent:
- 1:52e576abcb8a
teste bot?o
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bcostm | 0:c9d8fcdda4d0 | 1 | #include "mbed.h" |
bcostm | 0:c9d8fcdda4d0 | 2 | |
digo1234 | 2:5d81a684944c | 3 | DigitalIn mybutton(D2); |
digo1234 | 2:5d81a684944c | 4 | int count = 0; |
digo1234 | 2:5d81a684944c | 5 | int previous =1; |
digo1234 | 2:5d81a684944c | 6 | |
bcostm | 0:c9d8fcdda4d0 | 7 | int main() { |
ittraining | 1:52e576abcb8a | 8 | |
digo1234 | 2:5d81a684944c | 9 | |
bcostm | 0:c9d8fcdda4d0 | 10 | while(1) { |
digo1234 | 2:5d81a684944c | 11 | if (mybutton == 0 and previous == 1) { // Button is pressed |
digo1234 | 2:5d81a684944c | 12 | previous = 0; |
digo1234 | 2:5d81a684944c | 13 | count = count + 1; |
digo1234 | 2:5d81a684944c | 14 | if (mybutton ==1){ |
digo1234 | 2:5d81a684944c | 15 | previous =1; |
bcostm | 0:c9d8fcdda4d0 | 16 | } |
bcostm | 0:c9d8fcdda4d0 | 17 | } |
bcostm | 0:c9d8fcdda4d0 | 18 | } |
digo1234 | 2:5d81a684944c | 19 | } |