Projekt

Dependencies:   PM2_Libary

Revision:
25:ea1d6e27c895
Parent:
24:86f1a63e35a0
Child:
26:28693b369945
diff -r 86f1a63e35a0 -r ea1d6e27c895 main.cpp
--- a/main.cpp	Mon Mar 14 15:26:35 2022 +0100
+++ b/main.cpp	Mon Mar 14 14:34:36 2022 +0000
@@ -42,7 +42,7 @@
 // create SpeedController and PositionController controller objects, default parametrization is for 78.125:1 gear box
 float max_voltage = 12.0f;                  // define maximum voltage of battery packs, adjust this to 6.0f V if you only use one batterypack
 float counts_per_turn = 20.0f * 78.125f;    // define counts per turn at gearbox end: counts/turn * gearratio
-float kn = 180.0f / 12.0f;                  // define motor constant in rpm per V 
+float kn = 180.0f / 12.0f;                  // define motor constant in rpm per V
 // float k_gear = 25.0f / 78.125f;             // define additional ratio in case you are using a dc motor with a different gear box, e.g. 25:1
 // float kp = 0.1f;                            // define custom kp, this is the default speed controller gain for gear box 78.125:1
 
@@ -65,11 +65,11 @@
 
 // Groove Ultrasonic Ranger V2.0
 float us_distance_cm = 0.0f;    // define variable to store measurement
-RangeFinder us_range_finder(PB_12, 5782.0f, 0.02f, 17500); 
+RangeFinder us_range_finder(PB_12, 5782.0f, 0.02f, 17500);
 // RangeFinder us_range_finder(PB_12, 5782.0f, 0.02f,  7000); // create range finder object (ultra sonic distance sensor), 1/main_task_period_ms = 20 Hz parametrization
 
 // LSM9DS1 IMU, carefull: not all PES boards have an imu (chip shortage)
-// LSM9DS1 imu(PC_9, PA_8); // create LSM9DS1 comunication object, if you want to be able to use the imu you need to #include "LSM9DS1_i2c.h"   
+// LSM9DS1 imu(PC_9, PA_8); // create LSM9DS1 comunication object, if you want to be able to use the imu you need to #include "LSM9DS1_i2c.h"
 
 int main()
 {
@@ -88,7 +88,7 @@
     enable_motors = 1;
 
     // motor M1 is used open-loop, we need to initialize the pwm and set pwm output to zero at the beginning, range: 0...1 -> u_min...u_max: 0.5 -> 0 V
-    pwm_M1.period(pwm_period_s);        
+    pwm_M1.period(pwm_period_s);
     pwm_M1.write(0.5);
 
     // enable servos, you can also disable them at any point in your program if you don't want your servos to become warm
@@ -176,7 +176,7 @@
 }
 
 void user_button_pressed_fcn()
-{   
+{
     user_button_timer.reset();
 }