mirror of
https://github.com/modelec/servo_moteurs.git
synced 2026-03-18 21:40:31 +01:00
add clear message and change angle to radian
This commit is contained in:
@@ -51,8 +51,11 @@ void MyTCPClient::handleMessage(const std::string &message) {
|
||||
return;
|
||||
}
|
||||
int servo = std::stoi(args[0]);
|
||||
int angle = std::stoi(args[1]);
|
||||
this->pwm_setServoPosition(servo, angle);
|
||||
double angleRad = std::stof(args[1]) / 100;
|
||||
int angleDeg = static_cast<int>(angleRad * 180 / 3.14159);
|
||||
this->pwm_setServoPosition(servo, angleDeg);
|
||||
} else if (token[2] == "clear") {
|
||||
this->pwm_clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user