Questions tagged [button]

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

Filter by
Sorted by
Tagged with
14
votes
1answer
7k 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() { ...
14
votes
2answers
951 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 ...
11
votes
4answers
5k 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
2answers
626 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
2answers
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
7answers
15k 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
4answers
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
3answers
2k 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 ...
6
votes
3answers
785 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
3answers
6k 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
1answer
1k 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
5answers
11k 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
5answers
7k 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.
4
votes
2answers
598 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 ...
3
votes
3answers
27k 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(...
3
votes
2answers
118 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
3answers
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-...
3
votes
1answer
186 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
2answers
14k 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 ...
3
votes
1answer
291 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
3answers
3k 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
1answer
324 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
1answer
693 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
1answer
191 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 ...
3
votes
3answers
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
1answer
109 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 ...
2
votes
10answers
65k 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
4answers
845 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
3answers
82 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
2answers
303 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
4answers
11k 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
2answers
660 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
1answer
47 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
1answer
95 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
1answer
689 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
2answers
318 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
1answer
113 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
1answer
6k 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
1answer
9k 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
2answers
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&...
2
votes
2answers
4k 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
2answers
54 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
2answers
78 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
1answer
33 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
1answer
330 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
1answer
91 views

How can I know how far a button is pressed?

I want to make a system that can count coins. The problem that I know have is that I need a way to detect the size of the coin. The idea that I have is a beam that becomes smaller if you a inject a ...
2
votes
4answers
3k views

Write to serial only if the state of a light sensor changes

I need to know the times when an LED strip turns on and turns off. The LED switch is driven by light dependent resistor. When the sun goes down the LED strip turns on. This is all happening on a ...
2
votes
2answers
4k views

Update variable using buttons

I made a part of code to change the temperature limit for alarm system. On warm days user have to change the temperature limit with buttons and OLED display. The question is: How can the variable ...
2
votes
1answer
2k views

How to detect if more than one button was pressed

I am designing a turn signal bicycle blinker using two pushbuttons as input, one for each side, with a corresponding light for each button. The idea is this: Pressing one side makes same side start ...
2
votes
1answer
67 views

status whether the switch is connected to arduino or not?

I made a small circuit in which a push-button is connected to Arduino via a pulldown resistor. So, whenever it is pressed it connects to 5V otherwise pulled down to the ground. this is working fine ...

1
2 3 4 5
7