Module 9 Super Team / Mbed 2 deprecated hookey_controller

Dependencies:   EMG1 PIDController1 compute mbed InBetweenController PinDetect QEI

Committer:
AeroKev
Date:
Tue Oct 20 09:57:07 2015 +0000
Revision:
4:e021dacffa24
Parent:
3:0634f55c2021
Child:
5:5339a7be9fb7
Changed some stuff

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dolcaer 0:5f9d8f2142b6 1 #include "mbed.h"
dolcaer 0:5f9d8f2142b6 2 #include "emg.h"
AeroKev 3:0634f55c2021 3 #include "inbetweencontroller.h"
AeroKev 3:0634f55c2021 4 #include "pidControl.h"
AeroKev 3:0634f55c2021 5
AeroKev 3:0634f55c2021 6 // Define Objects
AeroKev 3:0634f55c2021 7 Ticker sample_timer;
dolcaer 0:5f9d8f2142b6 8
AeroKev 3:0634f55c2021 9 void tick() {
AeroKev 3:0634f55c2021 10 // EMG Reader
AeroKev 3:0634f55c2021 11 double output0 = sample(0);
AeroKev 3:0634f55c2021 12 double output1 = sample(1);
AeroKev 3:0634f55c2021 13 double output2 = sample(2);
AeroKev 3:0634f55c2021 14
AeroKev 3:0634f55c2021 15 // In Between Controller
AeroKev 4:e021dacffa24 16 double lastA, lastB, nextA, nextB;
AeroKev 4:e021dacffa24 17 getCurrent(lastA, lastB);
AeroKev 4:e021dacffa24 18 newPos(output0, output2, output2, lastA, lastB, nextA, nextB);
AeroKev 3:0634f55c2021 19
AeroKev 4:e021dacffa24 20 // Rotate the motors
AeroKev 4:e021dacffa24 21 move(nextA,nextB);
dolcaer 0:5f9d8f2142b6 22 }
dolcaer 0:5f9d8f2142b6 23
dolcaer 0:5f9d8f2142b6 24 int main()
dolcaer 0:5f9d8f2142b6 25 {
AeroKev 3:0634f55c2021 26 init();
AeroKev 3:0634f55c2021 27 initialize();
AeroKev 3:0634f55c2021 28 // Attach a timer to the function 'Sample' which fires every 0.002 seconds.
AeroKev 3:0634f55c2021 29 sample_timer.attach(&tick, 0.002);
AeroKev 3:0634f55c2021 30
AeroKev 3:0634f55c2021 31 while(1) { }
dolcaer 0:5f9d8f2142b6 32 }