Hello I have an ESP8266 card which is connected to my robot ( a mini car). Via MQTT I send him messages like "go forward", "backwards" etc... I'm already able to do that but now I would like to send a message with the time I would like him to do that action for. Like "backwards 2". He would go backwards for 2 seconds. And I don't really know how to that... If there is anyone who could help that would be great thanks !
Make your message (payload) comma delimited to send. Like B,2, for instance. Then at the other end use something like the strtok() function to dismantle the payload. See example #5 of the serial input basics tutorial for an example using strtok() to parse a payload.
Hey, thank you for that advice ! But I still don't know how I can tell my robot to do the action for a specified time without using a delay. Now I just do >if(message == "Forward") {
consigne = 150;
digitalWrite(pinmoteurAdirection, LOW);
digitalWrite(pinmoteurBdirection, HIGH);
}>
But I don't know how to implement the time in the equation
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.