Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FastPWM mbed QEI biquadFilter HIDScope MODSERIAL
Diff: main.cpp
- Revision:
- 37:c61d7768c18a
- Parent:
- 35:ba556f2d0fcc
- Child:
- 39:dcf3e5019a63
--- a/main.cpp Wed Oct 31 10:22:04 2018 +0000
+++ b/main.cpp Wed Oct 31 10:41:37 2018 +0000
@@ -153,7 +153,6 @@
float turninfo[3] = {error, refvalue, currentangle};
//float ( &fillarr( float (&outcome)[3] ) )[3] { // no decay; argument must be size 3
outcome = turninfo;
-
return outcome;
}
@@ -166,8 +165,8 @@
float PIDcontrol = PIDcontroller(refvalue,currentangle); // same for every motor
float error = ErrorCalc(refvalue,currentangle); // same for every motor
- pin6 = fabs(PIDcontrol); // different pins for every motor
- pin7 = PIDcontrol > 0.0f; // different pins for every motor
+ pin5 = fabs(PIDcontrol); // different pins for every motor
+ pin4 = PIDcontrol > 0.0f; // different pins for every motor
//pin6 = 0.4+0.6*fabs(PIDcontr); //geschaald
//pin6 = fabs(PIDcontr)/pi;
//pc.printf(" error: %f ref: %f angle: %f \r\n",error,refvalue,currentangle);
@@ -175,7 +174,6 @@
float turninfo[3] = {error, refvalue, currentangle};
//float ( &fillarr( float (&outcome)[3] ) )[3] { // no decay; argument must be size 3
outcome = turninfo;
-
return outcome;
}
@@ -194,22 +192,21 @@
//float motoroutcome1 = motor.attach(turn1,dt);
emergencybutton.rise(Emergency); //If the button is pressed, stop program
- //pin6 = 0.01;
-
+
while (true)
{
- float* motoroutcomel = turnl();
- float motorl1 = motoroutcomel[0];
- float motorl2 = motoroutcomel[1];
- float motorl3 = motoroutcomel[2];
+ //float* motoroutcomel = turnl();
+ //float motorl1 = motoroutcomel[0];
+ //float motorl2 = motoroutcomel[1];
+ //float motorl3 = motoroutcomel[2];
- //float* motoroutcomer = turnr();
- //float motorr1 = motoroutcomer[0];
- //float motorr2 = motoroutcomer[1];
- //float motorr3 = motoroutcomer[2];
+ float* motoroutcomer = turnr();
+ float motorr1 = motoroutcomer[0];
+ float motorr2 = motoroutcomer[1];
+ float motorr3 = motoroutcomer[2];
- pc.printf(" error1: %f ref1: %f angle1: %f \r\n",motorl1,motorl2,motorl3);
- //pc.printf(" error1: %f ref1: %f angle1: %f \r\n",motorr1,motorr2,motorr3);
+ //pc.printf(" errorl: %f refl: %f anglel: %f \r\n",motorl1,motorl2,motorl3);
+ pc.printf(" errorr: %f refr: %f angler: %f \r\n",motorr1,motorr2,motorr3);
wait(dt);
//wait(dt*10);
//wait(printingfreq); --> still needs to be defined
