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: HIDScope MODSERIAL QEI biquadFilter mbed
Diff: main.cpp
- Revision:
- 10:54b66bd1db20
- Parent:
- 9:6a065971d0ae
- Child:
- 11:eda4fbf91948
--- a/main.cpp Fri Oct 21 09:40:00 2016 +0000
+++ b/main.cpp Fri Oct 21 10:27:04 2016 +0000
@@ -70,7 +70,7 @@
// Next task, measure the error and apply the output to the plant
void motor1_Controller(double radians)
{
- double reference = -2*pi;
+ double reference = 2*pi;
volatile double error1 = reference - radians;
motor1 = P(error1,MOTOR1_KP) ;
// scope.set(velocityChannel,proportionalErrormotor1);
@@ -78,7 +78,7 @@
}
-void control(double proportionalErrormotor1)
+void control(double motor1)
{
if(abs(motor1)>0.3)
{
@@ -97,26 +97,25 @@
}
}
-
-
//****************MAIN FUNCTION*********************************
int main()
{motor1MagnitudePin.period(1.0/1000.0);
t1.attach(&fn1_activate, 0.1f);
t2.attach(&fn2_activate, 0.0001f);
t3.attach(&fn3_activate, 0.0001f);
-scope.set(velocityChannel, proportionalErrormotor1);
-scope.send();
-while(true){
+
+while(true)
+{
if(fn1_go)
{
fn1_go = false;
- control(proportionalErrormotor1);
+ control(motor1);
}
if(fn2_go)
{
fn2_go = false;
motor1_Controller(radians);
+
}
if(fn3_go)
{