gpio example for the Freescale freedom platform

Dependencies:   mbed

Fork of frdm_gpio by Freescale

Files at this revision

API Documentation at this revision

Comitter:
sam_grove
Date:
Wed Jul 16 09:49:22 2014 +0000
Parent:
8:a031d62c2a84
Commit message:
Update example to toggle faster and move object declarations to global scope

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Apr 09 04:29:23 2014 +0000
+++ b/main.cpp	Wed Jul 16 09:49:22 2014 +0000
@@ -1,15 +1,13 @@
 #include "mbed.h"
 
-int main() {
-    DigitalOut gpo(D0);
-    DigitalOut led(LED_RED);
+DigitalOut gpo(D0);
+DigitalOut led(LED_RED);
 
+int main()
+{
     while (true) {
-        gpo = 1;
-        led = 1; // off
-        wait(2);
-        gpo = 0;
-        led = 0; // on
-        wait(2);
+        gpo = !gpo; // toggle pin
+        led = !led; // toggle led
+        wait(0.2f);
     }
 }
\ No newline at end of file
--- a/mbed.bld	Wed Apr 09 04:29:23 2014 +0000
+++ b/mbed.bld	Wed Jul 16 09:49:22 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/6473597d706e
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/04dd9b1680ae
\ No newline at end of file