-
Dependencies: mbed
Diff: Teste2.cpp
- Revision:
- 1:24f21be80e14
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Teste2.cpp Wed Apr 18 15:27:14 2018 +0000 @@ -0,0 +1,32 @@ +#include "mbed.h" + +DigitalIn mybutton(USER_BUTTON); +DigitalIn habilita(PA_6); +DigitalOut myled(LED1); +DigitalOut enable (PB_6); +DigitalOut dir(PB_9); +DigitalOut step(PB_8); +//int lista[4][4] ={{0,0,0,1},{0,0,1,0},{0,1,0,0},{1,0,0,0}} +//int listainv[4][4] ={{1,0,0,0},{0,1,0,0},{0,0,1,0},{0,0,0,1}} + + +int main () { +enable = 0; + + while(1) { + if (mybutton == 0) { // botão usuário pressionado + dir = !dir; + } + step = 0; + wait(0.01); + step = 1; + wait(0.01); + + if (habilita == 0) { // botão externo pressionado + enable = !enable; + } +//myled = !myled; +//step = !step; +//wait(0.01); + } +} \ No newline at end of file