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.
Diff: main.cpp
- Revision:
- 1:b483225a5411
- Parent:
- 0:9ac802a0d2d9
- Child:
- 2:51248529975d
--- a/main.cpp Tue Sep 11 15:02:25 2018 +0000
+++ b/main.cpp Tue Sep 11 15:19:12 2018 +0000
@@ -1,15 +1,18 @@
#include "mbed.h"
#include "MODSERIAL.h"
+MODSERIAL pc(USBTX, USBRX);\
+
// Make a BlinkLEd function using Ticker
//Wait for a character to arrive pc.getc() in the main loop,
//if character == ‘r’ blink red LED
//if character == ‘b’ blink blue LED
//if character == ‘g’ blink green LED
+
Ticker blink; //Maak ticker aan
-enum states {r,b,g}; //Define possible states
-states currentState; //Make variable currentState
+//enum states {r,b,g}; //Define possible states
+char currentState; //Make variable currentState
DigitalOut ledr(LED_RED);
DigitalOut ledb(LED_BLUE);
@@ -19,15 +22,15 @@
{
switch (currentState)
{
- case r: //If the input character is r
+ case 'r': //If the input character is r
ledr = !ledr;
break;
- case b: //If the input character is b
+ case 'b': //If the input character is b
ledb = !ledb;
break;
- case g: //If the input character is g
+ case 'g': //If the input character is g
ledg= !ledg;
break;
@@ -35,7 +38,7 @@
// pc.print("There is no input");
break;
} // End of switch
-
+}
int main()
{