Let's Make Robots!

Clarification of parts

Can someone tell me if the switch that is located here is the same as the one that is used in this tutorial found here. It is a trivial part but if it stops you project then it can be deadly too....

AttachmentSize
DC_motor_control_bb.png77.68 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

In the tutorial there is an image of a momentary switch (that switch with the red button) but the fritzing schematic shows a toggle switch.
The function will be the same but the ‘red’ switch will pull the line high as long as it is pushed, but the toggle switch will hold its position.
… does this answer your question?

Does it mean that if I use a momentary switch, the motors will run only as long as I keep the switch presssed? If yes, then it is a problem. Why do we need a switch in the circuit in the first place?

The switch is used to drive the motor forward or backward as it says in the article:

"In the main loop(). read the switch. If it's high, turn the motor one way by taking one H-bridge pin high and the other low. If the switch is low, reverse the direction by reversing the states of the two H-bridge pins."

If you need the switch or not depends on your application. If you build a robot the switch may be insufficient since the robot must change direction from within the programmed behavior. If you build a motor test bench the switch might be sufficient.

Nils, what do you mean by sufficient and insufficient. I want to build a robot and what I can understand from your reply is that the switch is not necessary to use while making the motor shield as the micro controller does the job.
Go ahead and post your robot project. Then we get an idea about your problem space. We read what you want your robot to do. From there LMR can help you to find the solutions.

Ohk, I've posted my bot here (if you can call it a bot)...