![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Projekt
Diff: main.cpp
- Revision:
- 36:f678d693969f
- Parent:
- 35:57b39290aaea
- Child:
- 37:3c427322799d
--- a/main.cpp Wed Apr 06 09:58:39 2022 +0200 +++ b/main.cpp Wed Apr 06 11:05:29 2022 +0200 @@ -38,33 +38,35 @@ int counter_user_button = 0; bool counter_stopp = 0; enable_motors = 0; - + while(1){ - if (user_button.read() & !counter_stopp) { + printf( "counter %d stopp %d button %d \n",counter_user_button, counter_stopp, !user_button.read()); + if ((user_button.read() == 0) & (counter_stopp == 0)) { counter_user_button++; counter_stopp = 1; } - if (!user_button.read()){ + if (user_button.read()){ counter_stopp = 0; } if (counter_user_button >= 3){ counter_user_button = 1; } + + + } switch (counter_user_button){ case 1: - cout <<"case1"; enable_motors = 1; break; case 2: - cout <<"case2"; enable_motors = 0; - break; + break; } - } +} -} +