working version but stripped of most unnecessary code like print statements
Dependencies: HIDScope MODSERIAL biquadFilter mbed FastPWM QEI
Diff: main.cpp
- Revision:
- 30:7cc564d38bc4
- Parent:
- 29:ac08c1a32c54
- Child:
- 31:9c3b022f1dc3
--- a/main.cpp Mon Oct 24 22:28:43 2016 +0000 +++ b/main.cpp Tue Oct 25 08:04:01 2016 +0000 @@ -29,6 +29,7 @@ double emg22; double ref_x=0.000; double ref_y=0.000; +double speed=0.2; // create a variable called 'state', define it typedef enum { STATE_CALIBRATION, STATE_PAUZE, STATE_X, STATE_X_NEG, STATE_Y, STATE_Y_NEG, STATE_XY, STATE_XY_NEG } states; @@ -237,19 +238,19 @@ void change_x(int direction) { - ref_x=ref_x+0.0002*direction; + ref_x=ref_x+speed*direction; } void change_y(int direction) { - ref_y=ref_y+0.0002*direction; + ref_y=ref_y+speed*direction; } void change_xy(int direction) { - ref_x=ref_x+0.0002*direction; - ref_y=ref_y+0.0002*direction; + ref_x=ref_x+speed*direction; + ref_y=ref_y+speed*direction; } void my_pos() @@ -337,7 +338,7 @@ while(1) { if (sampletimer==true) { //sample(mystate); - sample(mystate); + sample_button(mystate); print_state(); change_ref(); sampletimer = false;