Dependencies: mbed QEI HIDScope biquadFilter MODSERIAL FXOS8700Q FastPWM
Diff: main.cpp
- Revision:
- 5:cee5f898b350
- Parent:
- 4:f988679bf9a1
- Child:
- 7:a32766b96d91
--- a/main.cpp Wed Sep 11 09:47:18 2019 +0000 +++ b/main.cpp Wed Sep 11 09:58:25 2019 +0000 @@ -5,17 +5,17 @@ //#include "BiQuad.h" //#include "FastPWM.h" #include <iostream> - +MODSERIAL pc(USBTX, USBRX); DigitalOut ledred(LED_RED); DigitalOut ledblue(LED_BLUE); DigitalOut ledgreen(LED_GREEN); InterruptIn button(SW2); -button.fall(PrintColor); + -MODSERIAL pc(USBTX, USBRX); Ticker Theticker; volatile char c='x'; +volatile int color=0; void PrintColor(void) { switch(c) @@ -50,6 +50,19 @@ { ledblue=!ledblue; } + else if (c=='d') + { + color+=1; + ledred=!ledred; + if (color%2==0) + { + ledgreen=!ledgreen; + } + if (color%4==0) + { + ledblue=!ledblue; + } + } else { ledred=1; @@ -60,6 +73,7 @@ int main() { + button.fall(&PrintColor); ledred=1; ledgreen=1; ledblue=1; @@ -71,7 +85,7 @@ c=pc.getc(); pc.printf("Color picked: '%c'\r\nNow counting so the system does something:\r\n",c); while (true) { - color+=1; + countr+=1; pc.printf("%i\r\n",countr); wait_ms(500); }