407 code

Dependencies:   mbed SeeedShieldBot BluetoothSerial

Revision:
0:ac051b1bec3c
Child:
1:6fe4d6e4c602
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu May 26 15:49:26 2022 +0000
@@ -0,0 +1,56 @@
+#include "mbed.h"
+#include "time.h"
+#define timedelay 500
+PwmOut LampStep(D3);
+DigitalOut LampDir(D5);
+AnalogIn ldr1in(A3);
+AnalogIn ldr2in(A4);
+DigitalOut ldr1out(D1);
+DigitalOut ldr2out(D0);
+DigitalOut PrismStep(D6);
+DigitalOut PrismDir(D8);
+DigitalIn button(USER_BUTTON);
+Timer t;
+DigitalOut led1(LED1);
+DigitalOut ms1(PC_1);
+DigitalOut ms2(PC_2);
+DigitalOut ms3(PC_3);
+/*void LampArm()
+{
+LampStep.write(0.01);
+wait(10);
+LampStep.write(0);
+wait(1000);
+}*/
+/* 
+void PrismMotor()
+{
+            
+}
+*/
+int main()
+{
+LampDir.write(1);
+ms1.write(3);
+ms2.write(3);
+ms3.write(3);
+int counter = 0;
+int x = 0;
+x = button.read();
+if (x == 0){
+    for (counter = 0; counter<=100; counter++)
+        {
+        LampStep.period_ms(100);
+        LampStep.pulsewidth_ms(5);
+        //counter+=1;
+        }
+    }
+else if (x == 1)
+    { 
+    LampStep.period_ms(0);
+    LampStep.pulsewidth_ms(0);
+    }
+}
+
+
+