BIPBIP CARRE

Dependencies:   mbed

Revision:
0:929b9389852e
diff -r 000000000000 -r 929b9389852e carre1/main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/carre1/main.cpp	Tue Jun 06 09:35:06 2017 +0000
@@ -0,0 +1,63 @@
+#include "mbed.h"
+#define periode 0.0001
+#define tourne 0.81
+#define dist 2.27
+
+DigitalIn fdc(D2);
+DigitalIn jack(D3);
+AnalogIn captg(A1);
+AnalogIn capteg(A2);
+AnalogIn capted(A3);
+AnalogIn captd(A4);
+PwmOut motg(D6);
+PwmOut motd(D8);
+DigitalOut Smot1(D7);
+DigitalOut Smot2(D9);
+
+int main()
+
+{
+    int ic,dist=ic;
+    motg.period(periode);
+    motd.period(periode);
+
+    if(jack.read()==1) {
+
+        Smot1.write(1);
+        Smot2.write(1);
+
+        //roule
+
+        motd.pulsewidth(0.00007);
+        motg.pulsewidth(0.00007);
+        wait(dist);
+        motd.pulsewidth(0.00007);
+        motg.pulsewidth(0.0001);
+        wait(tourne);
+
+        motd.pulsewidth(0.00007);
+        motg.pulsewidth(0.00007);
+        wait(dist);
+        motd.pulsewidth(0.00007);
+        motg.pulsewidth(0.0001);
+        wait(tourne);
+
+        motd.pulsewidth(0.00007);
+        motg.pulsewidth(0.00007);
+        wait(dist);
+        motd.pulsewidth(0.00007);
+        motg.pulsewidth(0.0001);
+        wait(tourne);
+
+        motd.pulsewidth(0.00007);
+        motg.pulsewidth(0.00007);
+        wait(dist);
+        motd.pulsewidth(0.00007);
+        motg.pulsewidth(0.0001);
+        wait(tourne);
+
+        motd.pulsewidth(0.0001);
+        motg.pulsewidth(0.0001);
+        wait(100000);
+    }
+}