Example project for the Line Follower robot.

Dependencies:   PM2_Libary Eigen

Revision:
29:d6f1ccf42a31
Parent:
28:3760373c234d
Child:
30:1e8295770bc1
--- a/main.cpp	Wed Mar 16 11:47:54 2022 +0100
+++ b/main.cpp	Fri Mar 18 09:44:52 2022 +0100
@@ -77,7 +77,7 @@
     user_button.fall(&user_button_pressed_fcn);
     user_button.rise(&user_button_released_fcn);
 
-    // start timers
+    // start timer
     main_task_timer.start();
 
     // set pullup mode: add resistor between pin and 3.3 V, so that there is a defined potential
@@ -104,7 +104,7 @@
             ir_distance_mV = 1.0e3f * ir_analog_in.read() * 3.3f;
 
             // command dc motors if mechanical button is pressed
-            if (mechanical_button) {
+            if (mechanical_button.read()) {
                 pwm_M1.write(0.75); // write output voltage to motor M1
                 speedController_M2.setDesiredSpeedRPS(0.5f); // set a desired speed for speed controlled dc motors M2
                 positionController_M3.setDesiredRotation(1.5f, max_speed_rps); // set a desired rotation for position controlled dc motors M3