Silvie van den Bogaard
/
determine_x_setpoint
Determines the setpoint in x direction of the robot. Robot specific variables still have to be set.
main.cpp
- Committer:
- Duif
- Date:
- 2018-10-08
- Revision:
- 0:0d70149fdb98
- Child:
- 1:f120a8734106
File content as of revision 0:0d70149fdb98:
//Determining the setpoint that the thing will have to follow #include "mbed.h" #include "MODSERIAL.h" DigitalIn button(SW2); DigitalIn direction(SW3); MODSERIAL pc(USBTX, USBRX); //makes sure the computer is hooked up //defining of the variables float x_prev = 0; //previous setpoint float x_new; //new setpoint float x_max; //maximum value of setpoint float x_min; //minimum value of setpoint float v; //moving speed of setpoint volatile int s; //value of the switch //equation is x_new = x_prev + s*v*dt void EMGOn(){ x_new = x_prev + s*v; x_prev = x_new; pc.printf("Set: %f",x_new); } int main() { pc.baud(115200); while (true) { s = button.read(); } }