Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed move4wheel2 EC CruizCore_R1370P
Diff: can/can.cpp
- Revision:
- 6:26724c287387
- Parent:
- 5:6cebe1c458a9
- Child:
- 7:44ce34007499
--- a/can/can.cpp Sat Mar 02 07:18:38 2019 +0000
+++ b/can/can.cpp Sat Mar 02 07:48:18 2019 +0000
@@ -20,14 +20,16 @@
if(msg.id == 1) { //from main
- id1_value[0] = msg.data[0]; //decide mode(1~3)
- id1_value[1] = msg.data[1]; //angle of left joystick(0~359)
+ id1_value[0] = (msg.data[0]>>6)%4; //decide wait/auto/manual(0~2)
+ id1_value[1] = msg.data[1]; //angle of left joystick(0~359)
id1_value[2] = msg.data[2];
- id1_value[3] = msg.data[3]; //BOTTONR1 off/on(0 or 1)
- id1_value[4] = msg.data[4]; //state of right joystick(1~3)
- id1_value[5] = msg.data[5]; //left joystick neutral position(0 or 1)
+ id1_value[3] = (msg.data[0]>>5)%2; //BOTTONR1 off/on(0 or 1)
+ id1_value[4] = (msg.data[0]>>3)%4; //state of right joystick(1~3)
+ id1_value[5] = (msg.data[0]>>2)%2; //left joystick neutral position(0 or 1)
+ id1_value[6] = (msg.data[0]>>1)%2; //decide right/left(0 or 1)
- //debug_printf("[0]=%d [1]=%d [2]=%d [3]=%d [4]=%d [5]=%d\n\r",id1_value[0],id1_value[1],id1_value[2],id1_value[3],id1_value[4],id1_value[5]);
+ debug_printf("[0]=%d [1]=%d [2]=%d [3]=%d [4]=%d [5]=%d [6]=%d\n\r"
+ ,id1_value[0],id1_value[1],id1_value[2],id1_value[3],id1_value[4],id1_value[5],id1_value[6]);
}
if(msg.id == 3) {
@@ -48,7 +50,7 @@
canread_led = 0;
}
- if(can1.write(CANMessage(7,ashi_data,4))) { //IDを7にして送信
+ if(can1.write(CANMessage(7,can_ashileddata,1))) { //IDを7にして送信
cansend_led = 1;
} else {
cansend_led = 0;
@@ -72,7 +74,6 @@
void UserLoopSetting_can()
{
-
can1.frequency(1000000);
can_ticker.attach(&can_readsend,0.01); //遅かったら早める
}
\ No newline at end of file