Good evening , From A few weekst I'm trying to write a sketch for a bluetooth robot , but I can not solve a Problem : using a buletooth module hc - 05 , I can move the robot , giving 5 options : go straight , turn a Right , turn Left one , go back , it stops ; The Problem is that once the dates of the robot Move Command to Switch to a subsequent action must necessarily give the command ' stop ' Otherwise, the robot will continue to Compiere 's previous action .
My goal would be to have a continuous movement As the duration of the pressure of the ' key ' of my smartphone ( Example : I hold down the f key that moves the robot forward once issued it will stop ) . I hope that I'm exhaustive State , thank you in advance All Those that will help me . Good evening .
You can use a timer and check to see if a move command comes in and if it did, start a timer. Once the timer expires or goes past a certain time duration, stop the robot.
You could also probably set something up on the transmitter side and just check if something is pressed or not. It could continuously send a dummy command when nothing is pressed, then once you press a move command, it will send that command instead. If the robot see the dummy command it knows to stop, otherwise it should move.
As the duration of the pressure of the ' key ' of my smartphone ( Example : I hold down the f key that moves the robot forward once issued it will stop ) .
You would need to design your own controller app then. The keyboard does not continuously send out key presses until you press send.
thanks you!!