Turning function

Dependencies:   mbed-rtos mbed

Files at this revision

API Documentation at this revision

Comitter:
vceyssens3
Date:
Mon May 01 01:03:22 2017 +0000
Commit message:
turning;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib 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 84070c2a9436 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon May 01 01:03:22 2017 +0000
@@ -0,0 +1,83 @@
+#include "mbed.h"
+#include "rtos.h"
+
+Serial pc(USBTX, USBRX);
+DigitalOut start(p30,1);
+DigitalOut right(p29,1);
+DigitalOut left(p28,1);
+DigitalOut up(p27,1);
+DigitalOut down(p26,1);
+DigitalOut on_switch(p25,0);
+DigitalOut myled(LED1);
+DigitalOut led2(LED2);
+DigitalOut led3(LED3);
+DigitalOut led4(LED4);
+DigitalIn encoder(p20);
+
+
+void starting_commands(){ // toggles the button to start the cop car
+    start = 0;
+    wait(0.1);
+    start = 1;
+    wait(0.1);
+    }
+
+
+void start_func() // sequence that gets the cop car into no noise run mode
+{
+    on_switch =1;
+    starting_commands();
+    starting_commands();
+    starting_commands();
+    starting_commands();
+    starting_commands();
+}
+
+int first_time = 0;
+int last_time = 0;
+
+void drive(){
+    
+       
+        right = 0;
+        wait(0.1);
+        up = 0;
+        wait(0.4);
+        up = right = 1;
+        wait(0.2);
+        
+}
+
+void reverse(){
+    
+        left = 0;
+        wait(0.1);
+        down = 0;
+        wait(0.4);
+        down= left=1;
+        wait(0.2);
+}
+
+int main() {
+   start_func();
+   drive();
+   reverse();
+   drive();
+   reverse();
+   drive();
+   reverse();
+   drive();
+   reverse();
+   drive();
+   reverse();
+   drive();
+   reverse();
+   drive();
+   reverse();
+   drive();
+   reverse();
+   drive();
+   reverse();
+   
+   
+}
diff -r 000000000000 -r 84070c2a9436 mbed-rtos.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Mon May 01 01:03:22 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/mbed_official/code/mbed-rtos/#58563e6cba1e
diff -r 000000000000 -r 84070c2a9436 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon May 01 01:03:22 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/mbed_official/code/mbed/builds/97feb9bacc10
\ No newline at end of file