Skip to content

Commit 48ee1f6

Browse files
authored
Merge pull request #2 from arduino-libraries/fw_protocol_upd
added single wheel set protocol (W, label, control_type)
2 parents 0c6d880 + fe8d210 commit 48ee1f6

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

examples/firmware_01/firmware_01.ino

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ SensorTofMatrix tof(alvik.wire, EXT_GPIO3, EXT_GPIO2);
2323
ucPack packeter(200);
2424

2525
uint8_t code;
26+
uint8_t label;
27+
uint8_t control_type;
2628
uint8_t msg_size;
2729

2830
unsigned long tmotor=0;
@@ -31,7 +33,7 @@ unsigned long tsensor=0;
3133
unsigned long timu=0;
3234

3335

34-
float left, right;
36+
float left, right, value;
3537
uint8_t leds;
3638

3739
uint8_t sensor_id = 0;
@@ -74,6 +76,17 @@ void loop(){
7476
case 'J':
7577
packeter.unpacketC2F(code,left,right);
7678
alvik.setRpm(left, right);
79+
break;
80+
case 'W':
81+
packeter.unpacketC2B1F(code,label,control_type,value);
82+
if ((label == 'L') && (control_type == 'V')) {
83+
alvik.motor_control_left->setRPM(value);
84+
}
85+
else if ((label == 'R') && (control_type == 'V'))
86+
{
87+
alvik.motor_control_right->setRPM(value);
88+
}
89+
7790
break;
7891
/*
7992
case 'S':

0 commit comments

Comments
 (0)