ECE 4180 Lab 2 Part 10

Dependencies:   Motor mbed

Fork of Motor_HelloWorld by Simon Ford

Revision:
1:b33bff7dc3ea
Parent:
0:7bbc230e00d6
--- a/main.cpp	Tue Nov 23 16:19:19 2010 +0000
+++ b/main.cpp	Tue Oct 09 00:50:42 2018 +0000
@@ -5,9 +5,16 @@
 
 Motor m(p23, p6, p5); // pwm, fwd, rev
 
-int main() {
-    for (float s= -1.0; s < 1.0 ; s += 0.01) {
-       m.speed(s); 
-       wait(0.02);
+int main()
+{
+    while (1) {
+        for (float s= -1.0; s < 1.0 ; s += 0.01) {
+            m.speed(s);
+            wait(0.02);
+        }
+        for (float s= 1.0; s > -1.0 ; s -= 0.01) {
+            m.speed(s);
+            wait(0.02);
+        }
     }
 }