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 PID QEI mbed EMG
Fork of PID_VelocityExample by
Revision 22:ae8012b12890, committed 2015-10-12
- Comitter:
- ewoud
- Date:
- Mon Oct 12 09:33:34 2015 +0000
- Parent:
- 21:4ddbe49c258a
- Commit message:
- integration issues
Changed in this revision
--- a/EMG.lib Mon Oct 12 08:48:43 2015 +0000 +++ b/EMG.lib Mon Oct 12 09:33:34 2015 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/teams/Numero-Uno/code/EMG/#b5f7b64b0fe4 +https://developer.mbed.org/teams/Numero-Uno/code/EMG/#84ff5b0f5406
--- a/inits.h Mon Oct 12 08:48:43 2015 +0000 +++ b/inits.h Mon Oct 12 09:33:34 2015 +0000 @@ -10,7 +10,7 @@ // Globals //****************************************************************************/ Serial pc(USBTX, USBRX); -HIDScope scope(3); // Instantize a 2-channel HIDScope object +HIDScope scope(2); // Instantize a 2-channel HIDScope object Ticker scopeTimer; // Instantize the timer for sending data to the PC InterruptIn startButton(D3); InterruptIn stopButton(D2);
--- a/main.cpp Mon Oct 12 08:48:43 2015 +0000
+++ b/main.cpp Mon Oct 12 09:33:34 2015 +0000
@@ -3,11 +3,13 @@
#include "PID.h"
#include "QEI.h"
#include "HIDScope.h"
+
+#include "inits.h" // all globals, pin and variable initialization
#include "EMG.h"
-#include "inits.h" // all globals, pin and variable initialization
void setGoFlag(){
if (goFlag==true){
+ //pc.printf("rate too high, error in setGoFlag \n\r");
// flag is already set true: code too slow or frequency too high
}
goFlag=true;
@@ -36,11 +38,6 @@
endTimer.start(); //Run for 100 seconds.
while (true){
- if(sample_go && systemOn==true)
- {
- sample_filter();
- sample_go = 0;
- }
if (goFlag==true && systemOn==true){
// get 'emg' signal
request_pos=y1;
@@ -97,14 +94,22 @@
}
// User feedback
- scope.set(0, request);
- scope.set(1, leftPwmDuty);
- scope.set(2, leftVelocity);
- scope.send();
+ //scope.set(0, request);
+ //scope.set(1, leftPwmDuty);
+ //scope.set(2, leftVelocity);
+ //scope.send();
pc.printf("pot2: %f, request: %f, lefVelocity: %f, output: %f \n\r",pot2.read(),request,leftVelocity,leftPwmDuty);
goFlag=false;
}
+ if(sample_go && systemOn==true)
+ {
+ sample_filter();
+ scope.set(0, y1);
+ scope.set(1, y2);
+ scope.send();
+ sample_go = 0;
+ }
}
//Stop motors.
