Wataru Shibazaki
/
Nucleo_minirobo_con
con_shiba
Revision 3:c95582aeaa4d, committed 2020-10-11
- Comitter:
- shibazakiwataru
- Date:
- Sun Oct 11 08:44:58 2020 +0000
- Parent:
- 2:d94fb02df854
- Commit message:
- contoro-ra-
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r d94fb02df854 -r c95582aeaa4d main.cpp --- a/main.cpp Sat Oct 10 02:35:37 2020 +0000 +++ b/main.cpp Sun Oct 11 08:44:58 2020 +0000 @@ -24,7 +24,7 @@ bool sw_in(int sw, int pre_sw){ bool rt_sw; - if (sw == true && pre_sw == false) rt_sw = true; + if (sw == false && pre_sw == false) rt_sw = true; else rt_sw = false; return rt_sw; } @@ -35,6 +35,8 @@ double d_joyx = joyR_x.read(); double d_joyy = joyR_y.read(); + pc.printf("%d,%d\n",d_joyx,d_joyy); + int buttons_int = 0; bool rotR = sw2.read(); @@ -62,6 +64,10 @@ if(sw_in(other,pre_other)){ buttons = 0b00010000;//16 } + + if(d_joyx <= 137 && d_joyx >= 117) d_joyx = 127; + if(d_joyy <= 137 && d_joyy >= 117) d_joyy = 127; + char joyx = char(int(255.0 * d_joyx)); char joyy = char(int(255.0 * d_joyy)); char rot = char(127 + 100*sw_in(rotR,per_rotR)- 100*sw_in(rotL,pre_rotL));