Aislinn Probst / Mbed 2 deprecated DigitalOut

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
probst
Date:
Fri Feb 13 03:12:25 2015 +0000
Commit message:
Exercises for Digital Output

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
diff -r 000000000000 -r d05b09903410 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Feb 13 03:12:25 2015 +0000
@@ -0,0 +1,61 @@
+#include "mbed.h"
+
+//declares a digital output on pin #14
+DigitalOut pin14(p14);
+
+//declares a digital output on LED3
+DigitalOut ledThree(LED3);
+
+//declare an array of digital outputs that includes pins 7, 21, and 16 in that order
+DigitalOut led[3]={p7,p21,p16};
+
+//declare the delcarations and set the output on pin 8 to a 1, pin 9 to a 0, and turn on LED1 and LED3
+DigitalOut leds[2]={LED1,LED3};
+DigitalOut pins[2]={p8,p9};
+int main() 
+
+
+{
+    int x = 4;
+    while(x == 1) //tests output on pin 14
+    {
+        pin14 = 0;
+        wait(1);
+        pin14 = 1;
+        wait(1);
+        
+        
+    }
+    
+    while(x == 2) // tests output on LED3
+    {
+        
+        ledThree = 0;
+        wait(.5);
+        ledThree = 1;
+        wait(.5);   
+         
+   }
+   
+   while(x == 3) //tests output on the array created with pin 7, pin 21, and pin 16
+   {
+       int i = 0;
+       while(i<4)
+       {
+           led[i] = 1;
+           wait(.5);
+           i++;
+       }
+       
+   }
+
+while(x == 4) //sets output on pin 8 to a 1, sets output on pin 9 to a 0, and turns on LED1 and LED3
+{
+    pins[0].write(1);
+    pins[1].write(0);
+    leds[0] = 1;
+    leds[1] = 1;
+    
+}
+    
+}
\ No newline at end of file
diff -r 000000000000 -r d05b09903410 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Feb 13 03:12:25 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e188a91d3eaa
\ No newline at end of file