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.
Fork of Minor_test_serial by
Revision 2:4ffe049e7231, committed 2016-09-12
- Comitter:
- JanderGilbers
- Date:
- Mon Sep 12 10:34:25 2016 +0000
- Parent:
- 1:26ce7013f2c5
- Commit message:
- RGB keyboard control;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Sep 12 10:14:01 2016 +0000
+++ b/main.cpp Mon Sep 12 10:34:25 2016 +0000
@@ -1,9 +1,17 @@
#include "mbed.h"
#include "MODSERIAL.h"
-DigitalOut myled(LED_GREEN);
+DigitalOut grled(LED_GREEN);
+DigitalOut rdled(LED_RED);
+DigitalOut blled(LED_BLUE);
MODSERIAL pc(USBTX, USBRX);
char c;
+int Ticker;
+
+void ticking(bool& a)
+{
+ a = !a;
+}
int main()
{
@@ -15,8 +23,24 @@
{
c = pc.getc();
pc.printf("%c", c); // print the value of variable i
- i++; // increment the variable
- myled = !myled; // toggle a led
+ switch (c)
+ {
+ case 'r' :
+ rdled = false;
+ grled = true;
+ blled = true;
+ break;
+ case 'b' :
+ rdled = true;
+ grled = true;
+ blled = false;
+ break;
+ case 'g' :
+ rdled = true;
+ grled = false;
+ blled = true;
+ break;
+ }
wait(0.1f);
}
}
