-
Dependencies: mbed
Teste2.cpp@1:24f21be80e14, 2018-04-18 (annotated)
- Committer:
- NathanLederman
- Date:
- Wed Apr 18 15:27:14 2018 +0000
- Revision:
- 1:24f21be80e14
-
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
NathanLederman | 1:24f21be80e14 | 1 | #include "mbed.h" |
NathanLederman | 1:24f21be80e14 | 2 | |
NathanLederman | 1:24f21be80e14 | 3 | DigitalIn mybutton(USER_BUTTON); |
NathanLederman | 1:24f21be80e14 | 4 | DigitalIn habilita(PA_6); |
NathanLederman | 1:24f21be80e14 | 5 | DigitalOut myled(LED1); |
NathanLederman | 1:24f21be80e14 | 6 | DigitalOut enable (PB_6); |
NathanLederman | 1:24f21be80e14 | 7 | DigitalOut dir(PB_9); |
NathanLederman | 1:24f21be80e14 | 8 | DigitalOut step(PB_8); |
NathanLederman | 1:24f21be80e14 | 9 | //int lista[4][4] ={{0,0,0,1},{0,0,1,0},{0,1,0,0},{1,0,0,0}} |
NathanLederman | 1:24f21be80e14 | 10 | //int listainv[4][4] ={{1,0,0,0},{0,1,0,0},{0,0,1,0},{0,0,0,1}} |
NathanLederman | 1:24f21be80e14 | 11 | |
NathanLederman | 1:24f21be80e14 | 12 | |
NathanLederman | 1:24f21be80e14 | 13 | int main () { |
NathanLederman | 1:24f21be80e14 | 14 | enable = 0; |
NathanLederman | 1:24f21be80e14 | 15 | |
NathanLederman | 1:24f21be80e14 | 16 | while(1) { |
NathanLederman | 1:24f21be80e14 | 17 | if (mybutton == 0) { // botão usuário pressionado |
NathanLederman | 1:24f21be80e14 | 18 | dir = !dir; |
NathanLederman | 1:24f21be80e14 | 19 | } |
NathanLederman | 1:24f21be80e14 | 20 | step = 0; |
NathanLederman | 1:24f21be80e14 | 21 | wait(0.01); |
NathanLederman | 1:24f21be80e14 | 22 | step = 1; |
NathanLederman | 1:24f21be80e14 | 23 | wait(0.01); |
NathanLederman | 1:24f21be80e14 | 24 | |
NathanLederman | 1:24f21be80e14 | 25 | if (habilita == 0) { // botão externo pressionado |
NathanLederman | 1:24f21be80e14 | 26 | enable = !enable; |
NathanLederman | 1:24f21be80e14 | 27 | } |
NathanLederman | 1:24f21be80e14 | 28 | //myled = !myled; |
NathanLederman | 1:24f21be80e14 | 29 | //step = !step; |
NathanLederman | 1:24f21be80e14 | 30 | //wait(0.01); |
NathanLederman | 1:24f21be80e14 | 31 | } |
NathanLederman | 1:24f21be80e14 | 32 | } |