Questions tagged [button]
A button is a simple input component which responds to being pushed by a user.
331
questions
14
votes
1
answer
961
views
How to avoid that my arduino clicks eternally?
I have accidentally implemented a program that imitates the click of the mouse.
The problem is that now I can´t delete the program because each time that I connect the USB, the computer starts ...
14
votes
1
answer
8k
views
Button state changing randomly
I have a push button wired to my Arduino but it seems to be triggering randomly.
I have one pin of the button connected to pin 2 on the arduino and the other connected to ground.
void setup() {
...
11
votes
4
answers
6k
views
Choosing wireless tech for lowest possible lag
I am drafting a pub quiz project, where the Referee gives a signal and multiple players push their buttons. The first to push wins the right to give an answer.
I want all buttons (referee's + X ...
8
votes
2
answers
669
views
How frequently do you need to poll UI buttons before they are perceived as laggy?
Whilst it is possible, and sometimes desirable, to use pin change interrupts to read the state of buttons, it is simpler to poll the state of buttons in loop(). This is a commonly used technique.
If ...
8
votes
2
answers
2k
views
Performance of internal vs external resistors
Is there any significant performance trade-off between buttons wired with the internal vs external pull-up/down resistors? I see a lot of tutorials demonstrating the use of external resistors when ...
7
votes
7
answers
17k
views
Good button debouncing/stateChange library
I need debouncing/stateChange for a push button configuration. Is there a good library for debouncing/stateChange buttons in Arduino (without delay)?
7
votes
4
answers
1k
views
What design patterns can I use to handle user input and display updating?
I've used enough products with embedded microcontrollers and unresponsive UIs to know that it can make or break a product. Even a slight delay or lag between the button presses and the display ...
6
votes
5
answers
3k
views
What is the best technique to design a 20 push button circuit
I will be controlling a robot with more than 10 motors which means I'll need 2 buttons each to control moving forward and backward. My controller is an Arduino mega. Is 1 pin = 1 button the best ...
6
votes
5
answers
8k
views
How do I repurpose Arduino's reset button
Is there a way to repurpose the reset button for the code, like an on-board button? I don't need it to reset, but it would be useful to make it run through a list of RGB LED cycles.
5
votes
3
answers
8k
views
Why does this button have a connection to ground?
I am testing this basic button example from the Arduino tutorial page.
This circuit lets power flow to pin 2 when the button is pressed. When the button is not pressed, the power goes through the ...
5
votes
3
answers
3k
views
Why does my sketch report too many button presses?
I've been using a button to interact with a sketch (on my Uno), and it's mostly working fine. However, sometimes it seems to be detecting multiple presses when it's only pressed once.
It's a small ...
5
votes
3
answers
1k
views
How do I make another action repeat inside a loop?
So, I've just started programming Arduino (and also in general), so I'm doing basic things, like switching on and off LED's.
I've made them light in a sequence and then turning them off (in the same ...
5
votes
1
answer
2k
views
Reading button presses with the 74HC4067E multiplexer
My project is progressing quite well, but I am having some issues reading button presses through my MUX.
The Goal
Cycle through twelve buttons and twelve LEDs. When a button is pressed, light up the ...
4
votes
3
answers
35k
views
Detecting if a push button was pressed and released
I want to detect if a push button was pressed and released again. So I thought the right approach would be to first wait while the pin yields LOW and then wait while the pin yields HIGH:
void push(...
4
votes
5
answers
14k
views
Stop Led's from blinking
My code:
// Pin 13 has a LED connected on most Arduino boards.
// give it a name:
int led = 13;
const int buttonPin = 2;
// the setup routine runs once when you press reset:
void setup() {
// ...
4
votes
2
answers
762
views
Interrupts: use of the "volatile" keyword with a structure pointer for button debounce
I've written a small sketch targeted at the Arduino Uno (ATmega328P) to debounce a mechanical pushbutton using the summing/integration technique:
#include <IntegratingDebounce.h>
#define ...
4
votes
3
answers
4k
views
Multiple Buttons on Single Analog Pin and Trigger Pin Arduino Uno
I've researched how to attach multiple buttons to a single analog input using a resistor network. Instructables has a good lesson on this: http://www.instructables.com/id/How-to-access-5-buttons-...
4
votes
2
answers
16k
views
Voltage changes but digitalRead always HIGH
I developed simple push button project
I used wemos D1 mini
I connected D3 pin to pull down 1K resistor.
I used multimeter to measure D3 pin voltage.
When i push the button, D3 pin voltage changes ...
4
votes
2
answers
14k
views
Debouncing a button with interrupt
I tried to follow the answer here:
https://arduino.stackexchange.com/a/18545/51302
Unfortunately I can only get the interrupt to go once (on serial monitor is the time of that first interrupt), then ...
4
votes
1
answer
502
views
Controlling relays with IR and button
What I have:
1 x 8 channel relay
1 x IR receiver
1x Arduino Uno
1x momentary switch
1x breadboard
1x 10K resister
I think the wiring is all ok as for the most part things are working as they should.....
3
votes
2
answers
157
views
How to make an arduino button to forget his past purpose?
For my school project im making an arduino speedometer for a bicycle. I will be using a reed switch sensor to get the speed. There will also be an clock and a termometer, it will be on a 16x2 lcd ...
3
votes
1
answer
216
views
Powering potientiometer/button with a digital pin
When I read articles/tutorials about the Arduino Uno, the potentiometer and button always get power from the 5 V pin instead of from digital pins.
May I know whether the two components above can ...
3
votes
1
answer
427
views
Code test the duration press of the button
I wrote code that tracks the duration of a button click. It has bounce protection and frequent clicks. (Freeze)
My code:
bool freeze_time, btn_read, debounce;
unsigned int freeze_timer, btn_timer;
#...
3
votes
1
answer
73
views
Simulating a button press using the Serial Monitor to run a Servo
I'm kind of new to Arduino and C, and I was having trouble with this sketch. I'm working on a project to control 6 servos using virtual buttons. When I hold down the button, the servo moves forward ...
3
votes
3
answers
4k
views
Breaking a switch case from an ISR
I'm struggling with something. My CPU sits in a switch case state machine like this:
switch(expression) {
case constant-expression_1 :
statement(s);
break; /* optional */
case ...
3
votes
1
answer
796
views
sending ctrl-z in a struct?
I have a set of buttons wired to an arduino leonardo that are meant to send either single keystrokes to a computer "a, b, c..." etc, or a key sequence like ctrl+z (to perform an undo command.) ...
3
votes
1
answer
289
views
Increase or decrease const byte value inside the code with a push button
I'm kind of new in the Arduino world. I decided to make a self learning project with an Arduino where it controls a conveyor that simply moves from right to left and back again. There is a start and ...
3
votes
3
answers
2k
views
Button and switch to turn on and off LED and changing after time
I have system connected to an Arduino Uno where I want to read whether the switch is open or closed.
Based on if the switch is open/closed, I want an LED light to turn on/off. When the switch is ...
3
votes
1
answer
203
views
Button to optocoupler to fire camera 4 times
Ok, this is my first project where I've not had @forsvunnet close by to help.
I've got a camera connected to an optocoupler, that just fires HIGH then LOW.
I can't get a button working with it, so ...
2
votes
10
answers
66k
views
How to toggle LED on button press?
I want to have a LED turn on when I push a button and go off when I push the button a second time.
This code doesn't work:
const int buttonPin = 4;
const int motorPin = 10;
const int ledPin = ...
2
votes
4
answers
962
views
Why doesn't this debounce function work?
Edit 2
I made a function that works, but I'm still confused about just one thing...
I'm very confused about how variables work in C++.
In this program...
boolean debounce(void)
{
static ...
2
votes
3
answers
121
views
Send button only works when pressed immediately after
I am new to Arduino and I am trying to create a Morse code based "chat".
I can submit a message in Morse code using the send button (the one on the right,) and when I press the button on the ...
2
votes
2
answers
504
views
How do I make LEDs lights up one by one according to how long the button was pressed and hold
In my project, I am trying to create a timer display with LEDs base on how long a button was pressed and hold.
There are 8 LED lights in total, when the toggle button was pressed, 1st LED lights up; ...
2
votes
4
answers
13k
views
My button control working in reverse
I built this circuit to learn button control.
But my code (or button) is working in reverse. I want to initialize led flash effect when the button is pressed with this code
buttonState = ...
2
votes
2
answers
77
views
Tone() generates a high pitched sound when button is released
I have a simple circuit that makes use of the tone() function to produce some sounds.
I also have a button, hooked with an interrupt function, that whenever is pressed, a variable changes.
Sometimes, ...
2
votes
1
answer
992
views
Arduino Timer with increase time button
I have an Arduino project to do, which requires a countdown timer(which I've already done). I connected a push button, and when I press that button I need it to increase my countdown timer by +10 ...
2
votes
3
answers
90
views
80 Apple Homebuttons and a steppermotor [closed]
I am graduating in a month and I want to make an installation with 80 apple homebuttons which are connected to a stepper motor. The idea is that each button that is pressed, turns the stepper motor ...
2
votes
2
answers
356
views
Arduino with multiple buttons - will power be an issue?
I have a spare Arduino Uno lying around, which I figured I could attempt to turn into a game controller. First clear issue, that immediately popped up, was that there are not enough digital input pins ...
2
votes
1
answer
123
views
1x4 Button membrane help
Im trying out this membrane from Adafruit that i bought last week but i have a little issue. ITS SO SENSITIVE! i as so just touch it with my finger and it transmits!. Anyone that has worked with this ...
2
votes
1
answer
9k
views
Newbie Question with 4 pin button
I suspect this is a very Naive question.
But the answer will teach me a lot.
Why does this circuit work when I connect the Digital Input (Digial Pin 2) to Pin 4 of the push button. But does not when ...
2
votes
2
answers
693
views
Simply Button Problem (Teensy 2.0)
I am getting back into doing some hardware stuff after a fairly long time away and am having a hard time getting back into it. I have a Teensy 2.0 and am trying to run a basic sketch that when a ...
2
votes
1
answer
81
views
Adding a common activation pin to a group of buttons
I'm working on an Uno, which has only two interrupt capable pins, but i need at least three buttons to wake it up from its power saving mode.
Is there a way to wire buttons such that, in addition to ...
2
votes
1
answer
137
views
Button to stop a stopwatch not working correctly!
I'm trying to implement a stopwatch with an LCD display, and I'm supposed to be using the attachInterrupt command to catch the button press. The clock runs perfectly, but the button input isn't caught ...
2
votes
1
answer
10k
views
Button with switch timer and reset time function + LED feedback. What am I doing wrong?
Beginner here.
I´ve been trying to implement a button function timer working with millis() instead of delay as I want the button to be responsive while the timer is running.
So far I´ve managed to ...
2
votes
2
answers
5k
views
Multiple buttons on single interrupt, how to debounce?
Buttons on separate interrupt pins work fine (triggered on FALLING), bouncing is handling by forcing a 80ms lockout period during which further presses are ignored. I like that solution for being ...
2
votes
2
answers
75
views
Rasberry Pi Controlling Arduino - Reads "Ghost" Input - Doesn't Complete Logic Loop
I am using an Arduino Atmega2560 clone, I have used it many times before with satisfactory results - although I haven't used it with my Rpi before.
My Raspberry Pi is model 4 (B I think?).
#define ...
2
votes
2
answers
132
views
Can anyone help be get readings off of my potentiometer with a push of a button?
Hi I'm trying to get my Arduino Uno code to work with a in a specific way where if I push a button, the Arduino will read the raw potentiometer value once and if I don't push it nothing happens.
https:...
2
votes
1
answer
41
views
Input state is stuck HIGH when function called using input also uses same input to call another function
I'm writing a choose-your-own-adventure style project for a class project. My Arduino Uno is set up with a 16-digit LCD display and two pushbuttons with pulldown resistors. I'm wanting each function ...
2
votes
1
answer
453
views
Run light sequence function continuously in if statement
My goal - run light sequence function on momentary button press (button 2) continuously until another of the 3 momentary buttons are pressed.
/* switch
*
* Each time the input pin goes ...
2
votes
2
answers
1k
views
for loop iterated only once
I have written a little project, it works so far as it should but the for loop is only iterated once, then the result is displayed on the LCD.
#include <LiquidCrystal.h>
#include <stdlib.h&...