Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed QEI HIDScope biquadFilter MODSERIAL FastPWM
Diff: main.cpp
- Revision:
- 2:d9b0ebf3fcca
- Parent:
- 1:b862262a9d14
- Child:
- 3:68d78770639b
diff -r b862262a9d14 -r d9b0ebf3fcca main.cpp
--- a/main.cpp Wed Sep 04 15:30:13 2019 +0000
+++ b/main.cpp Tue Sep 10 15:03:50 2019 +0000
@@ -1,23 +1,32 @@
#include "mbed.h"
-//#include "HIDScope.h"
-//#include "QEI.h"
#include "MODSERIAL.h"
-//#include "BiQuad.h"
-//#include "FastPWM.h"
-
-DigitalOut led(LED_RED);
MODSERIAL pc(USBTX, USBRX);
+DigitalOut led(LED_RED);
+Ticker ReadEnCoder;
+
+volatile char color='r';
+
+void knipper()
+{
+ led = !led;
+}
int main()
{
pc.baud(115200);
- pc.printf("\r\nStarting...\r\n\r\n");
-
- while (true) {
-
- led = !led;
-
- wait_ms(500);
+ ReadEnCoder.attach(knipper,0.05);
+ while (true)
+ {
+ color = pc.getc();
+ if (color == 'r'){
+ DigitalOut led(LED_RED);
+ }
+ if (color == 'g'){
+ DigitalOut led(LED_GREEN);
+ }
+ if (color == 'b'){
+ DigitalOut led(LED_BLUE);
+ }
}
-}
+}
\ No newline at end of file