for testing

Dependencies:   mbed

Fork of 1_blinky by MakingMusicWorkshop

Files at this revision

API Documentation at this revision

Comitter:
maclobski
Date:
Tue May 10 03:31:21 2016 +0000
Parent:
0:232d11a32e07
Commit message:
for testing

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 232d11a32e07 -r 641d32f7b4ec main.cpp
--- a/main.cpp	Mon May 09 19:47:06 2016 +0000
+++ b/main.cpp	Tue May 10 03:31:21 2016 +0000
@@ -3,18 +3,22 @@
 DigitalOut red(LED_RED);             // we create a variable 'red', use it as an out port
 Ticker flipper;   //Ticker = recurring interrupt to repeatedly call a function at a specified rate
 
-void flip() {
+// YOUR CODE HERE
+
+//REMOVE
+static void blinky() {
+    // the LED is either on or off (a 1 or a 0). We can inverse the value with the `!` (inverse operator).
+    // the flipped value is what we write back to the LED, thus toggling the LED.
     red = !red;
 }
-
-// YOUR CODE HERE
+//END_REMOVE
 
 // this code runs when the microcontroller starts up 
 int main() {
     red = 1;  //turn the led off, (1=off, I know it's weird)
     
     // we want to blink an led, every 500 ms.
-    flipper.attach(&flip, 0.5); // the address of the function to be attached (flip) and the interval (in seconds)
+    flipper.attach(&blinky, 0.5); // the address of the function to be attached (flip) and the interval (in seconds)
  
     // spin in a main loop. flipper will interrupt it to call flip
     while(1) {}