Irfan Refai
/
EMG_check_or
Irfan EMG Check
Fork of EMG_check by
main.cpp
- Committer:
- sivuu
- Date:
- 2016-09-23
- Revision:
- 0:b7cb5d3978b5
- Child:
- 1:6605db01437d
File content as of revision 0:b7cb5d3978b5:
#include "mbed.h" DigitalOut led(LED_RED); DigitalOut led2(LED_BLUE); DigitalIn sw2(SW2); DigitalIn sw3(SW3); Serial pc(USBTX, USBRX); int main() { pc.baud(115200); int n; n = 0; while (true) { if (sw3 == 0){ // als knopje 3 wordt ingedrukt dan wordt er 1 opgeteld bij n n++; pc.printf("%i \n\r",n); wait (0.5); } else { n=n; pc.printf("geen switch"); } if (n%2 == 0) { //runt menuutje 1 als het even is //menu 1 pc.printf("n is even \n"); wait (0.5); char c = pc.getc(); if (c == 's'){ pc.printf("up \n"); wait (0.5); } else if (c == 'd'){ pc.printf("down /n"); wait (0.5);} } else { // runt menuutje 2 als het oneven is // menu 2 pc.printf("n is oneven \n"); wait (0.5); char c = pc.getc(); if (c == 's'){ pc.printf("right \n"); wait (0.5);} else if (c == 'd'){ pc.printf("left /n"); wait (0.5);} else {} } } }