Questions tagged [button]

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

Filter by
Sorted by
Tagged with
4
votes
2answers
600 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 ...
1
vote
1answer
10k views

OneButton with pins A6 and A7

I noticed that OneButton library does not work with pins A6 and A7 (with A1 and A2 it works good) on my Arduino Nano. Is it because A6 and A7 are Analog only? There is possibility to make them work ...
-2
votes
1answer
34 views

currentbuttonstatus [closed]

I'm trying to use momentary push buttons to switch bi color LED between RED and GREEN. I've got one working, but when I try to adapt the code for more buttons, it doesn't work. I'm just changing the ...
0
votes
1answer
181 views

attachInterrupt for mega 2560 not triggering

I recently bought a mega 2560 to toy around with as a hobby. It's pretty fun so far, but I've recently gotten stuck while trying to use attachInterrupt with a button. I'm using the CHANGE mode, and ...
0
votes
1answer
517 views

Need help with using LED matrix with pushbuttons

I am building a small project that uses a pair of 8x8 LED matrix (driven by the MAX7219), a pair of SG90 servos, a HC-SR04 ultrasonic sensor, a 16x2 LCD (Hitachi HD44780 driver), some push buttons and ...
0
votes
1answer
174 views

Trying to read the current position of a flex sensor and store it as a variable? NANO ATmega328p

I am trying to write a code to read the current position of a flex sensor when a button is pushed and use that data to pulse a piezo. I set it up to read the flex sensor and to alarm when it gets 100 ...
1
vote
3answers
3k views

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

I have used attachInterrupt() to reset my program to the beginning. It actually interrupts while running the 3 states as shown below inside of the if statement but when I press the actual button it ...
0
votes
1answer
81 views

Servo speed in a Toggle Code

I am new to Arduino and am trying to figure out servos. Right now I have a toggle button code for the servos. Although I want to know how to speed them up. Is there a way to do this? Currently, this ...
0
votes
1answer
295 views

Capacitors, Arduinos and Saving Data

In short, I have programmed and wired a speed/odometer and all is working well. However, I need to save data from the components/sensors once a power button is pressed, which has led me down the road ...
0
votes
1answer
70 views

Best method of detecting peg in hole [closed]

I’ve got a large wall with 1” holes scattered about. I’ve got some wooden pegs that fit perfectly into these holes. Now I’m thinking of creating a light installation based on the pegs, but i’m ...
-1
votes
1answer
169 views

Press button and Send Message Error

The problem is that sometime I don't even need to press the button and it sent message and keep on sending continuously. What I want to do is that once the button is pressed, sent 1 message. I ...
0
votes
2answers
329 views

Comparing button presses to correct sequence

I am creating a memory game with the Arduino. It has four buttons, each for a different colored led. The leds will blink in a random sequence and either fail or add another light in the next sequence ...
0
votes
1answer
32 views

Button isn't working properly

I am new in arduino trying to make race game. My problem is that my button (all buttons) is working sometimes and sometimes not. I am pretty sure that it's because of my code. Could you please help me ...
0
votes
3answers
134 views

Detect button press inside a for() cycle

I was working on a project with an LED strip, where I'd like to cycle through various effects with just a press of a button. The problem is that I don't know how to detect the press of the button to ...
0
votes
1answer
575 views

How to add a pedestrian button code to a traffic light with ultrasonic sensor?

So I have a project to create a 2 set of traffic lights which would detect a car coming and stopping on the ultrasonic sensor and my code would allow the traffic lights to loop and let the car through....
1
vote
1answer
59 views

My Arduino keeps telling me the button is being pushed

My code is simple simple for the button. There is no reason why this shouldn't work... I think. I honestly have no clue what's wrong. Output: Code: #include <SPI.h> #include <MFRC522.h>...
0
votes
3answers
2k views

Debouncing Multiple Buttons

I'm creating a binary calculator with my Arduino. This will take two different binary numbers and add them together. I am focusing right now on the Byte One Input screen. For this, I can use two ...
0
votes
1answer
51 views

Steppers only vibrate, not rotate with I2C

The goal of my project is to be able to control two steppers with 4 buttons. Steppers are connected to Adafruit Motor shield(the older one) which is stacked on Arduino UNO, buttons are connected to ...
1
vote
1answer
1k views

Arduino UNO(master read) + NANO(slave write) i2c buttons+stepper

First of all, I'm new to arduino. Check the EDIT line below the two codes. I have connected motor shield to arduino uno. Connection between the two arduinos are A5 to A5, A4 to A4, 5V to 5V and GND ...
0
votes
1answer
143 views

Arduino - Push Button State Problem

My problem is I want the buzzer to stop after a certain amount of time, regardless if it is still pressed or not. I have tried to implement a boolean statement to the code but to no avail(I'm not ...
1
vote
2answers
529 views

Can I change this code to use a potentiometer instead of a push button [closed]

The following code is for a pyrograph power supply that uses an ATtiny85. I want to change it, so instead of a push button I have a potentiometer being the control of the temperature. Can anyone guide ...
1
vote
1answer
95 views

Buttons, LOW vs no connection

I'm working with a very simple circuit to understand push buttons. The code in the tutorial uses the INPUT_PULLUP pinmode. I understand the idea of the pinmode, but I have two questions: There must ...
-5
votes
1answer
210 views

Using C - How do I make my button press nearly instant without using interrupts [closed]

How can I make the press of a button nearly instant, WITHOUT using interrupts or millis() - and NO preset arduino functions, just C. There is a delay at the end of my while loop of 500ms - perhaps ...
0
votes
1answer
1k views

Sharing serial Rx to read a push button on ESP8266-01

I'd like to know if it's possible, and if so how to use the serial Rx pin in a shared way to read a push button? I've seen people using it in sort of a dedicated way but my idea is to use it ...
1
vote
1answer
199 views

Basic Arduino Question. Trying to turn off leds turned on through the serial monitor by using a push button

I'm new to using the serial monitor. I have a code set up so that LEDs turn on when I type an input on the keyboard. I know how to turn them off using a keyboard but I and can't figure out why the ...
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(...
1
vote
3answers
4k views

Using a pushbutton to power Arduino on and off

I need help adding a pushbutton to provide power to an Arduino to save power, as I am using a battery and the same button to power it off. This is the circuit I wish to implement. Thanks.
0
votes
3answers
5k views

Change the sequence of LEDs with button press

I am new to arduino. I have created a circuit , here is the image: I want something that as I press the button the sequence of LEDs will change and as I press the button again , the sequence will ...
0
votes
3answers
62 views

Combing two codes to make it work on the same time but not affecting the other code?

I am trying to make a game where there are arrows going towards an object (in this case I printed x) and you have to evade the arrows. When you press the button it is supposed to print x on the top ...
0
votes
1answer
175 views

Concave button wiring with Arduino

I am new to working with Arduino and I have a basic question. I have an entire circuit set up and functioning, but I would like to add an arcade style button (Larger concave style) like this. So my ...
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 ...
1
vote
1answer
242 views

Help with multi function momentary buttons

I'm using the PunchThrough Bean and trying to build a two button project that has multiple functions. The idea is the user can press button 1 or button 2 for either short or long presses, or they can ...
1
vote
1answer
170 views

How to reset an arduino while being able to know which button has been pressed?

Context I keep the board in sleep mode and want to wake it with different buttons. I need to know which button has been pushed on boot. In the following schematic, SW-R is actually used to reset the ...
0
votes
1answer
521 views

Modify On board 4 pin switch to work with Arduino

I have a HDMI Switch module which switches Input signals. It has a 4 pin push button to switch inputs. ( - ) I want to modify the button in order to control it with an Arduino. (push via Arduino ...
1
vote
2answers
519 views

State Machine Logic problem with added states monitoring safety switches

I have been working on getting a state machine to work correctly but am having trouble with adding in the last bit of logic. What it needs to do is several things: Read two button inputs. Make sure ...
1
vote
1answer
33 views

Arduino receives HIGH when the button is LOW

I just got a simple scheme where i have a button connected to the 5V connector and to the 4th digital PIN and then i got a led connected to the 2nd PIN and to the GND. When i press the button the LED ...
0
votes
2answers
8k views

Arduino simultaneous push button for a counter

I am a newbie with arduino. I am trying to have a counter with 3 buttons. Each Button when pressed will increase the number of counts. The counter should still count if button 2 is pressed while ...
1
vote
3answers
183 views

Problem with Dual Safety Switches Initiating Timed Relay

I have been working on an Arduino project that has me kind of stumped. What it needs to achieve is that two momentary safety switches need to be pushed and held within a specified time frame as ...
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&...
1
vote
1answer
47 views

Variables displayed incorrectly

I am making a keypad and when I try to save the buttons that were pushed they reset back to zero. int tmp = 1; int digit = 1; int a = 0; int b = 0; int c = 0; int d = 0; int code = 0; void setup() { ...
1
vote
3answers
65 views

Why did my pushbutton LED circuit work when my wiring was wrong?

I had a Coursera Arduino homewhere wherein you create a simple pushbutton-controlled LED circuit. I used the example "button.ino" script that's builtin to the Arduino IDE, without modification. I'll ...
-4
votes
3answers
145 views

ARDUINO led bar indicator if/for/else [closed]

Thanks to anyone willing to help! this is my first weekend arduino tinkering. i have an ARDUINO pro mini i attached 6 leds on pin 2-7 i attached two push-buttons on pin 10-11. I want the leds to light ...
2
votes
2answers
622 views

How to read a timer's value once stopped?

I've downloaded the Timer1 library but unfortunately it seems that the read() method has been removed from it. I tried also SimpleTimer library from the arduino website but the program didn't compile ...
0
votes
3answers
10k views

Arduino code to control 4 led's from 4 buttons

This is my very first arduino sketch and it's causing me a bit of a headache. Sounds so simple really all I want the sketch to do is digitalread from one of 4 digital input pins and then digitalwrite ...
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 ...
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 ...
0
votes
0answers
186 views

How to read resistive buttons with Arduino Pro Micro?

I am trying to read some resistive buttons presses on a PCB like this: This is the full sketch I am using: #include <Keyboard.h> byte ZbuttonPin = 3; void setup() { // initialize the ...
0
votes
1answer
373 views

How do I pull up D1-D6 using 10k ohm resistors?

I'm using push buttons to control CR servos (button1=turn CW; button2=turn CCW). How do I pull up D1-D6 and what does that do exactly? I can't find a tutorial that explains it well enough how to use ...
0
votes
2answers
171 views

Arduino open door (outdoor) tonemelody

My problem lies in the fact that I can not stop the "void loop" function and more accurately "StatInDoor". I have to make sure that the "ButtonOpenDoor" works independently of "ButtonCall". If someone ...
0
votes
2answers
165 views

Hardware interrupts for buttons not directly assigned to pins

The Adafruit LCD shield offers an LCD and access to 4 button, using only a two wire connection with the Arduino. This is achieved with the MCP23017 I2C port expander IC. These buttons are not ...

1 2 3
4
5
7