Project BioRobotics Group 19
Dependencies: FastPWM HIDScope MODSERIAL QEI biquadFilter mbed
Diff: main.cpp
- Revision:
- 2:d3687b2c4e37
- Parent:
- 1:1221419474b3
- Child:
- 3:5c3edcd29448
diff -r 1221419474b3 -r d3687b2c4e37 main.cpp --- a/main.cpp Mon Sep 25 14:29:28 2017 +0000 +++ b/main.cpp Mon Sep 25 14:32:19 2017 +0000 @@ -1,4 +1,3 @@ -// TEST VERSION #include "BiQuad.h" #include "FastPWM.h" #include "HIDScope.h" @@ -16,48 +15,44 @@ bool stateChanged = true; // Make sure the initialization of first state is executed // DEFINITIONS -InterruptIn homeButton(SW2); // Button to go to home state -InterruptIn hitButton(SW3); // Button to go to hit state -float voltage; // FUNCTIONS // Turn motors off void TurnMotorsOff() { - pc.printf("Turning motors off \r\n"); // Turn motors off + // Turn motors off } // Move to home void MoveToHome() { - pc.printf("Moving to home \r\n"); // Move to home + // Move to home } // Filter signals -float FilterSignal(float signal) +float FilterSignal(// Signal) { - pc.printf("Filtering signal \r\n"); // Filter signal - voltage = signal; - return voltage; + // Filter signal + return // Voltage } // Motor 1 -void RotateMotor1(float voltage) +void RotateMotor1(// Voltage) { - pc.printf("Rotating motor 1 \r\n"); // Rotate motor 1 + // Rotate motor 1 } // Motor 2 -void RotateMotor2(float voltage) +void RotateMotor2(// Voltage) { - pc.printf("Rotating motor 2 \r\n"); // Rotate motor 2 + // Rotate motor 2 } // Hit the ball void HitBall() { - pc.printf("Hitting the ball \r\n"); // Rotate motor 3 + // Rotate motor 3 } // States function @@ -76,7 +71,7 @@ } // Home command - if(!homeButton) + if(//HOME COMMAND) { currentState = HOMING; stateChanged = true; @@ -108,23 +103,21 @@ } // EMG signals to rotate motor 1 - if(false) + if(// EMG signal) { - FilterSignal(1); // Filter the signal - RotateMotor1(voltage); // Rotate motor 1 - pc.printf("%f \r\n", voltage); + FilterSignal(// Signal); // Filter the signal + RotateMotor1(// Voltage); // Rotate motor 1 } // EMG signals to rotate motor 2 - if(false) + if(// EMG signal) { - FilterSignal(2); // Filter the signal - RotateMotor2(voltage); // Rotate motor 2 - pc.printf("%f \r\n", voltage); + FilterSignal(// Signal); // Filter the signal + RotateMotor2(// Voltage); // Rotate motor 2 } // Hit command - if(!hitButton) + if(// HIT COMMAND) { currentState = HITTING; stateChanged = true;