Template project for University of York ELE00032C Lab 6

Dependencies:   UoY-serial

Files at this revision

API Documentation at this revision

Comitter:
ajp109
Date:
Wed Feb 16 15:03:57 2022 +0000
Parent:
1:ec2d05bb8112
Commit message:
Update function name to match script

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r ec2d05bb8112 -r 3eacc92b984b main.cpp
--- a/main.cpp	Thu Feb 04 16:39:47 2021 +0000
+++ b/main.cpp	Wed Feb 16 15:03:57 2022 +0000
@@ -4,7 +4,7 @@
 DigitalOut dir2(D3);
 PwmOut pwm(D4);
 
-void motor(float speed) {
+void setMotorSpeed(float speed) {
     if (speed > 0) {
         dir1 = true;
         dir2 = false;
@@ -18,13 +18,13 @@
 
 int main() {
     while (true) {
-        motor(1.0);
+        setMotorSpeed(1.0);
         thread_sleep_for(1000);
-        motor(0.0);
+        setMotorSpeed(0.0);
         thread_sleep_for(1000);
-        motor(-0.5);
+        setMotorSpeed(-0.5);
         thread_sleep_for(1000);
-        motor(0);
+        setMotorSpeed(0);
         thread_sleep_for(1000);
     }
 }