mbed_example / Mbed OS DigitalOut_HelloWorld Featured

Fork of DigitalOut_HelloWorld by Mbed

Files at this revision

API Documentation at this revision

Comitter:
mbedAustin
Date:
Fri Mar 27 18:59:59 2015 +0000
Parent:
2:b4e2eee99a28
Child:
4:340f9fb00d71
Commit message:
updated example to demo API

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	Sat Sep 20 21:47:16 2014 +0000
+++ b/main.cpp	Fri Mar 27 18:59:59 2015 +0000
@@ -3,10 +3,15 @@
 DigitalOut myled(LED1);
 
 int main() {
+    int connected = myled.is_connected();   // check that myled object is initialized and connected to a pin
+    printf("myleD connection stattus = %d", connected);
     while(1) {
-        myled = 1;  // turn myled on
-        wait(0.2);
-        myled = 0;  // turn myled off
-        wait(0.2);
+        myled = 1;          // set LED1 pin to high
+        printf("\n\r myled = %d",myled);
+        wait(0.5);
+        
+        myled.write(0);     // set LED1 pin to low
+        printf("\n\r myled = %d",myled.read() );
+        wait(0.5);
     }
 }
--- a/mbed.bld	Sat Sep 20 21:47:16 2014 +0000
+++ b/mbed.bld	Fri Mar 27 18:59:59 2015 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/487b796308b0
\ No newline at end of file