Assignment 3 and 4. Both in commits.

Dependencies:   MODSERIAL mbed

Files at this revision

API Documentation at this revision

Comitter:
vsluiter
Date:
Fri Sep 04 08:27:05 2015 +0000
Parent:
2:ae67659d1fca
Commit message:
Small change to better explain the enum type.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri Sep 04 07:26:58 2015 +0000
+++ b/main.cpp	Fri Sep 04 08:27:05 2015 +0000
@@ -29,8 +29,11 @@
 
 //first part is creating a new datatype, enum blinkstate
 //second part is defining the names between {}
-//third part is creating a variable of the enum blinkstate type.
-enum blinkstates {BLINKRED,BLINKGREEN,BLINKBLUE,BLINKNONE} blink_state;
+enum BlinkState {BLINKRED,BLINKGREEN,BLINKBLUE,BLINKNONE};
+
+//we now have a new datatype BlinkState. Just as with
+//floats and ints, we can create a new variable and initialize it:
+BlinkState blink_state = BLINKNONE;
 
  
  //function to flip one LED
@@ -69,7 +72,6 @@
 int main()
 {
     Ticker ledtick;
-    blink_state = BLINKNONE;//initialize
     ledtick.attach(blink3Leds, period_led/2);
 
     r_led.write(led_off);