final

Dependencies:   Servo1 mbed

Fork of ES200_Project2_1 by Project 2

Revision:
0:b6a454c0b00a
Child:
1:852f86d263c8
diff -r 000000000000 -r b6a454c0b00a main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Oct 11 19:15:00 2018 +0000
@@ -0,0 +1,40 @@
+#include "mbed.h"
+#include "Servo.h"
+#include "Motor.h"
+
+Servo myservo(p21);
+Servo myservo2(p22);
+Motor m(p26,p30,p29);
+DigitalIn sw1=(p16), sw2=(p17), sw3=(p18), sw4=(p19), sw5=(p20);
+BusOut lights(p5,p6,p7,p8,p9);
+
+
+int main()
+{
+    while(1) 
+    {
+        if(sw1==1) {
+            lights=1;
+            //myservo motor on
+        }
+        if(sw2==1) {
+            lights=3;
+            //m turns on
+            }
+        if(sw3==1) {
+            lights=7;
+            //myservo2 on
+            }
+        if(sw4==1) {
+            lights=0xF;
+            //dc motor off
+            }
+        if(sw5==1) {
+            lights=0x1F;//wrong hex number?----need 11111 in hex
+            //servo motor off, all lights on
+            }
+        else {
+            lights=0;} //no switches on = no lights on
+        
+    }
+}