Hi! What do you guys do in order not to short circuit h-bridge when programming something like this.
In my sketch below, there's no problem from moveForward to reverse, but reverse to forward, there's a point where motor1a and motor1b are HIGH. I also have problems with left, right.....
if I put motorstop in middle it would keep stopping??
motor1a and motor1b is One motor(if it's not obvious :))
Yes, but would it make the motor keeps stopping, like stop forward stop forward?
Only if you call the function more than once. You don't keep shifting your car into drive, do you? Why would you be doing that to your robot?
The functions should be doing nothing more than shifting the transmission. Separate functions should handle speed, just like your car. Your gas pedal is not connected to your transmission.
PaulS:
Only if you call the function more than once. You don't keep shifting your car into drive, do you? Why would you be doing that to your robot?
The functions should be doing nothing more than shifting the transmission. Separate functions should handle speed, just like your car. Your gas pedal is not connected to your transmission.
That's my problem I can't make it not to call stop function more than once. I added a stop in my sketch, but i
think this will keep stopping and going. What's the right way of doing this?Thanks for the replies. btw. this is for object following robot.
Just in case it didn't take the first time? Maybe you need three or four more calls.
What do you mean just in case it didnt take the 1st time, i only wrote it once, thats 4 different pins. Im just thinking itll loop while moving forward.
Im sorry, im not going to ask this stupid questions if i already know what to do lol.
What do you mean just in case it didnt take the 1st time, i only wrote it once, thats 4 different pins. Im just thinking itll loop while moving forward.
How many times in those 6 lines do you set motor1a's state? What do you set it to each time?
How many times do you NEED to set it?
Im just thinking itll loop while moving forward.
Nothing in that code loops. If looping happens, it is in some part of your code that you are keeping to yourself. You can't expect us to help you with code that you are not willing to share.