Octopus!!
Dependencies: 2017NHKpin_config FEP HMC6352 PID QEI R1307 ikarashiMDC omni_wheel
Fork of KANIv3 by
Diff: bot/bot.cpp
- Revision:
- 52:320f910ca6ca
- Parent:
- 50:3a7c858aa0f9
--- a/bot/bot.cpp Mon Nov 13 17:33:30 2017 +0900 +++ b/bot/bot.cpp Thu Nov 23 11:49:39 2017 +0900 @@ -94,7 +94,7 @@ if(!pad1.getButton2(5)) { axis.resetOffset(); - debugSerial.printf("Force RESeT\n\r"); + //debugSerial.printf("Force RESeT\n\r"); } if((beforestick >= 0.2 && pad1.getStick(0) < 0.2) || (beforestick <= -0.2 && pad1.getStick(0) > -0.2)) { @@ -212,8 +212,8 @@ if (!pad2.getButton2(1)) nishijoSword.move(WIND_UP_SPEED); if(pad2.getButton2(0) && pad2.getButton2(1)) nishijoSword.move(0); - if (!pad2.getButton2(2)) nishijo.move(-SWORD_SPEED); - if (!pad2.getButton2(3)) nishijo.move(SWORD_SPEED); + if (!pad2.getButton2(3)) nishijo.move(-SWORD_SPEED); + if (!pad2.getButton2(2)) nishijo.move(SWORD_SPEED); if(pad2.getButton2(2) && pad2.getButton2(3)) nishijo.move(0); } else { tentacle.stop(); @@ -228,14 +228,29 @@ void Bot::checkConnection() { - if(receiveSuccessed1) debugSerial.printf("ON "); - else debugSerial.printf("OFF "); + if(receiveSuccessed1 == 1) debugSerial.printf("ON "); + else debugSerial.printf("%d ",receiveSuccessed1); - if(receiveSuccessed2) debugSerial.printf("ON\r\n"); - else debugSerial.printf("OFF\r\n"); + if(receiveSuccessed2 == 1) debugSerial.printf("ON\r\n"); + else debugSerial.printf("%d\r\n",receiveSuccessed2); } void Bot::checkDegree() { debugSerial.printf("%f %f\r\n",plane.getRawDegree(), plane.getCalculationResult()); } + +void Bot::checkPacket() +{ + char buf=0; + while(1) { + buf = pad1.getc(); + debugSerial.printf("%d %c\r\n",buf,buf); + } +} + +void Bot::checkReceiveData() +{ + debugSerial.printf("%f %f %f %f\r\n",pad1.getStick(0),pad1.getStick(1),pad1.getStick(2),pad1.getStick(3)); + debugSerial.printf("%f %f %f %f\r\n",pad2.getStick(0),pad2.getStick(1),pad2.getStick(2),pad2.getStick(3)); +}