Skip to content

added single wheel set protocol (W, label, control_type) #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion examples/firmware_01/firmware_01.ino
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ SensorTofMatrix tof(alvik.wire, EXT_GPIO3, EXT_GPIO2);
ucPack packeter(200);

uint8_t code;
uint8_t label;
uint8_t control_type;
uint8_t msg_size;

unsigned long tmotor=0;
Expand All @@ -31,7 +33,7 @@ unsigned long tsensor=0;
unsigned long timu=0;


float left, right;
float left, right, value;
uint8_t leds;

uint8_t sensor_id = 0;
Expand Down Expand Up @@ -74,6 +76,17 @@ void loop(){
case 'J':
packeter.unpacketC2F(code,left,right);
alvik.setRpm(left, right);
break;
case 'W':
packeter.unpacketC2B1F(code,label,control_type,value);
if ((label == 'L') && (control_type == 'V')) {
alvik.motor_control_left->setRPM(value);
}
else if ((label == 'R') && (control_type == 'V'))
{
alvik.motor_control_right->setRPM(value);
}

break;
/*
case 'S':
Expand Down