Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 42015

A button is a simple input component which responds to being pushed by a user.

2 votes

Question about Buttons and INPUT_PULLUP

It doesn't matter what type of button you use. You could even use a wire and let it touch ground when you want a "press". That also would work correctly. …
chrisl's user avatar
  • 16.5k
1 vote
Accepted

Metal pushbutton voltage drops only to 3.15V when OFF

Since you connected to pin to NC (normally connected), the button is connected to 3.3V when not pressed, and to nothing when pressed - and in that case the pullup resistor pulls it towards 3.3V. …
chrisl's user avatar
  • 16.5k
1 vote
Accepted

read state from button to check if clicked

The button consists only of two contacts, which get pressed together, when you press the button. So the button can connect the pin to either ground or Vcc, but not to both. … Reading a button click: In your code you don't read the "button click", but only the state of the button. Thus you get multiple times 0 for one long enough button press. …
chrisl's user avatar
  • 16.5k
3 votes
Accepted

How to make an arduino button to forget his past purpose?

Depending on input events (like the user pressing the button), you do transitions between the states. I already wrote a rather detailed answer about FSMs for this question. … There you execute your current button code. When you sense a double tap on the button, you change to the DISPLAY_SPEED state. From there on a button press to the DISPLAY_CLOCK state and so on. …
chrisl's user avatar
  • 16.5k
0 votes
Accepted

How to count steps of a stepper motor with AccelStepper?

You get that error, because the step() method is protected in the AccelStepper class. It is not meant for calling by the user. AccelStepper instead wants you to state, what kind of movement you want ( …
chrisl's user avatar
  • 16.5k
5 votes
Accepted

Arduino alternating between high and low signal without button press

If you don't do that, your button and pulldown resistor are not connected to anything but the digital input pin. So there is nothing setting the state of that pin (HIGH or LOW). … Make sure your button and pulldown resistor are actually electrically connected to ground. Bridge any gaps in the power rails, that your breadboard might have. …
chrisl's user avatar
  • 16.5k
1 vote

Trying to light an LED with one Button and have no idea what is wrong

I think your problem lies in the else-if-statement, where you try to compare 3 different values. While this doesn't thrown a compiling error in my Arduino IDE, it will probably not do, what you are tr …
chrisl's user avatar
  • 16.5k
0 votes

light leds from an array

The transition from the first to the second state happens, when the playback button is pressed. The transition back happens, when the playback is finished. … You are already doing this in the if statement if( mode == HIGH && previous == LOW && millis() - time1 > debounce) { (it only triggers the recording of a new button, if a button was pressed and the …
chrisl's user avatar
  • 16.5k
0 votes

I need help creating a code that moves a DC motor CW or CCW based off of 2 different buttons

To formulate the comments into an answer: In principle it is of course possible to put an encoder onto a DC motor shaft and then drive the motor, until you reach the desired position. But you won't ge …
chrisl's user avatar
  • 16.5k
1 vote

Arduino DC motor with 2 buttons

In your code the buttons only control the direction, but are not turning the motor on or off. This is only be done with the potentiometer, which can be set to zero speed. To really enable the motor w …
chrisl's user avatar
  • 16.5k
1 vote

Using attachInterrupt() to make a reset button for my code?

state 0 do_something(); break; case 1: // state 1 do_another_thing(); break; } } Note: Depending in your target you may want to add code for button … debouncing, so that one button press is really sensed as one press, not more. …
chrisl's user avatar
  • 16.5k
0 votes

Push Button to Drive Power to Servo

Yes, that should be safe, as long as the button can conduct the needed current. That depends on the type of button. You can simply test this. If the button get's hot, it is too small for this. … If it should happen, that the button cannot conduct the needed current, you have 2 ways to go: Just use a bigger button. …
chrisl's user avatar
  • 16.5k
1 vote
Accepted

Substitute multiple potentiometers for push buttons and single potentiometers

If yes, you measure the analog voltage, calculate the pitch and save it into the corresponding element of the pitches array: for(int button=0;button < N_BUTTONS;button++){ if(digitalRead(button_pins … [button])){ pitches[button] = analogRead(A0)/13; } } This always works for multiple pressed buttons at once. …
chrisl's user avatar
  • 16.5k
1 vote
Accepted

Arduino Mega, 6 push buttons for each analog input (A0-A9) - closing one results in reading ...

You can fix this by using one bottom resistor for each group of 2 buttons, each connected between 5V and the analog input/button system. …
chrisl's user avatar
  • 16.5k
3 votes
Accepted

Adding a common activation pin to a group of buttons

You can connect all the buttons to a single interrupt pin by ORing them via diodes (like Gerben wrote in the comments). That would look like this: simulate this circuit – Schematic created using Ci …
chrisl's user avatar
  • 16.5k

15 30 50 per page