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.
Revision 3:b05acad8736e, committed 2015-09-04
- 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);