Irfan Refai
/
EMG_check_or
Irfan EMG Check
Fork of EMG_check by
main.cpp
- Committer:
- irfanmoh
- Date:
- 2016-09-23
- Revision:
- 2:049f61b9ebcb
- Parent:
- 1:6605db01437d
File content as of revision 2:049f61b9ebcb:
#include "mbed.h" DigitalOut led(LED_RED); DigitalOut led2(LED_BLUE); DigitalIn sw2(SW2); InterruptIn sw3(SW3); Serial pc(USBTX, USBRX); int n = 0; void SwitchN() { n++; } int main() { pc.baud(115200); while (true) { sw3.fall(&SwitchN); char c = pc.getc(); switch (c) { case 's': { if (n%2 == 0) { pc.printf("up \n\r"); } else { pc.printf("right \n\r"); } break; } case 'd': { if (n%2 == 0) { pc.printf("down \n\r"); } else { pc.printf("left \n\r"); } break; } } } }