Lights

Dependencies:   Servo1 mbed

Files at this revision

API Documentation at this revision

Comitter:
m211656
Date:
Thu Oct 11 19:15:00 2018 +0000
Commit message:
Project 2 trial 1

Changed in this revision

Servo.lib Show annotated file Show diff for this revision Revisions of this file
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 b6a454c0b00a Servo.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Servo.lib	Thu Oct 11 19:15:00 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/m211656/code/Servo1/#e083d186980a
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
+        
+    }
+}
diff -r 000000000000 -r b6a454c0b00a mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Oct 11 19:15:00 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/e95d10626187
\ No newline at end of file