Push button, Arduino, Dc motor

Sure you can do so. But if the button and its contacts is not the problem you have to analyse further anyway.

You have to check all possabilities.

as there are:

  • broken wire
  • bad contact on breadboard
  • defect LED
  • defect IO-pin
  • defect button

For testing the IO-pin itself you can do a very very simple test:

Connect one jumperwire with GND on the arduino-board
Connect a second jumperwire with IO-pin 3.
If you touch the two blank open ends of the two jumperwires with each other you have a very simple "button".

For testing this is sufficient.

Do you have an LED and a resistor in the range of 300 Ohm to 1000 Ohm?
If yes you could build a very simple tester with this if the switch makes contact or not

+5V------300 Ohm-resistor-----LED-------Button---------GND
If you press the button the LED should light up
if you have connected the LED the right way.
LEDs light only up if anode is connected towards plus cathode is connected towards GND

It is no problem if you connect an LED to 5V the wrong way. The LED just doesn't light up.
Connect and the LED pins vice versa and the LED should light up.

Again pre-test if the LED itself is working:

+5V------300 Ohm------LED-----GND

Check if the wires itself are conductant.
Use a different pair of wires.

Can you please post a list of the components that you have at hand
Can you post what your budget is to buy additional equipment.
Would $15 for a simple digital multimeter be affordable for you?
Are you planning to learn much more about electronics or will this project be your only electronics project?

best regards Stefan

What type of button do I need to use?

simple momentary push-button. Any kind of button that closes its contact when pressed down.

Have you done the test with two jumperwires?
One jumperwire connected do GND
a second jumper-wire connected to IO-Pin
and then touching the two not yet connected ends of jumper-wire 1 with jumper-wire 2 ??

It might be that the problem is NOT the button!

You should test the code and your hardware with the jumper-wire
before buying a new dozen of different buttons

something like this
image
or this
image

or this
image

or this
image
or this
image
or this
image

or this
image

I tried changed the button, code works in Serial monitor, but when I try it in real circuit it doesn't. The button was working properly, and the motors are working properly but when I connect these 2 together it doesn't seem like functioning.
My power circuit is Power Supply 12V 10A --> Regulator step down (LM2596S) --> 2 L298N --> Arduino Uno R3
And the function for controlling is Arduino Uno R3 --> 2 L298N --> 3 Motors.

draw a handdrawn schematic that shows all connections.
Post your complete code as a code-section
And explain in more detail what you mean with

You are working on an informatic project and what is most needed in an informatic prtoject is guess what? precise and sufficient detailed information

If you are unsecure about how much information is sufficient write another 5 sentences that describe all the details you have not yet decribed.

The more details you post the faster your project will be finished

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.