Raphael Schmidt
/
GrannyStepper
Projekt
Diff: main.cpp
- Revision:
- 39:c0c2e33a2181
- Parent:
- 38:ba15402d9c94
- Child:
- 40:47997e887235
diff -r ba15402d9c94 -r c0c2e33a2181 main.cpp --- a/main.cpp Wed Apr 06 11:48:51 2022 +0200 +++ b/main.cpp Wed Apr 13 10:58:34 2022 +0200 @@ -37,7 +37,7 @@ int counter_user_button = 0; bool counter_stopp = 0; - enable_motors = 1; + while(1){ @@ -49,20 +49,34 @@ if (user_button.read()){ counter_stopp = 0; } - if (counter_user_button >= 3){ + if (counter_user_button >= 4){ counter_user_button = 1; } float speed_counter; switch (counter_user_button){ case 1: - speed_counter = 1.0f; + enable_motors = 0; + speed_counter = 0.0f; break; case 2: - speed_counter = 0.5f; + enable_motors = 1; + speed_counter = 0.1f; + break; + case 3: + speed_counter = 1.0f; break; } - pwm_M1.write(speed_counter); - printf( "counter %d stopp %d button %d speed %f \n",counter_user_button, counter_stopp, !user_button.read(), speed_counter); + + + + /*if (counter_user_button == 1 || counter_user_button == 3 || counter_user_button == 5){ + speedController_M1.setDesiredSpeedRPS(speed_counter); + //pwm_M1.write(speed_counter); + counter_user_button++; + }*/ + + printf( "counter %d speed %f \n",counter_user_button, speed_counter); + } }