Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [button]

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

1
vote
2answers
83 views

Why does current flow along a wire instead of a resistor right next to it? [closed]

I am having trouble understanding exactly what is going on in a circuit where when a button is pressed an LED goes on. Also, I have the Arduino UNO. The schematic can be seen at: 2:36 of this video: ...
0
votes
1answer
34 views

PWM Control, How to stop LED from Flickering?

What is required is controlling the brightness of an LED using both Buttons and a Potentiometer, Button A: Increase Button B: Decrease /Dim Potentiometer: Increase and Decrease, This however must ...
0
votes
0answers
18 views

How to use push buttons with arduino [closed]

how can i store the immediate state of the bush button ? for example , when pressing the button makes LED turns on even after releasing it and when pressing it again it turns off.
1
vote
4answers
651 views

changing state of an LED using a pushbutton leads to unstable result

I am trying to run this code: const int buttonPin = 7; const int ledPin13 = 13; int buttonState = 0; int lastButtonState = buttonState; bool flag = true; void setup() { // ...
0
votes
0answers
37 views

ESP8266 /ESP12F use flash button as input without using loop()

I couldn't find a proper answer anywhere on internet. I want to use the FLASH button as input in the setup() function and do not use the loop() with deepsleep mode (this part comes later). I tried ...
2
votes
1answer
75 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; #...
0
votes
1answer
37 views

1st LED turn ON when 1st button is pressed and other LEDs remaining OFF

I have 2 LEDs and 2 buttons. What I want to code is when first button pressed the 1st LED turn on (stay on for 5 seconds) and 2nd LED remain off, and same if 2nd button pressed the 2nd LED turn on and ...
0
votes
2answers
98 views

Combining 2 sensors in one code with 1 push button

I am trying to create a circuit with one tactile pushbutton, and LCD and two sensors: 1) temperature, and 2) pulse sensor. When the circuit is on, the LCD initially shows the reading from the temp ...
0
votes
0answers
123 views

Nested “switch” statements menu

I know that menus were discussed perhaps a thousand times here and everywhere. But using a ready solution is not something that I'm looking for because I know I won't learn the concept if I use them. ...
0
votes
3answers
108 views

Do I need a pull-up/down resistor for button LED circuit?

When reading up on how to make a circuit that turns an LED on when a button is held down, I keep finding people saying a pull up or down resistor must be involved, to avoid the flickering state of the ...
1
vote
0answers
285 views

Stepper Motor button control with A4988 Driver

So I'm quite new to programming and have inevitably worked myself into a corner. What I am trying to accomplish is to allow for a stepper motor, (powered by an A4988 driver) to move with the push of a ...
-1
votes
2answers
49 views

Confusion between switch and if?

Following code is to control two LEDs for on and off by two dedicated push buttons. I have used if() for each condition and I was not comfortable writing this code, as I could feel, it can be better ...
0
votes
1answer
86 views

Arduino button-controlled LED with AVR Assembly

I am trying to make a simple button-controlled LED, but I cannot seem to get any input from the button that would change the state of the LED. In other words, the program keeps branching to lighton, ...
0
votes
1answer
87 views

Controlling LED and Button with single pin

I am trying to use an ATTINY85/Ardunio Uno to turn an LED on and listen to a button input. I don't mind if the LED turns on when the button is used. I am have found this thread from a couple of ...
0
votes
1answer
94 views

How to fix this code so instead of having to hold button to change led, you can press?

const int buttonPin = 1; // the pin number of the pushbutton input pin const int ledPins[] = {2, 3, 4, 5, 10, 11, 12, 13}; // variables will change: int buttonState = 0; // variable for reading the ...
0
votes
1answer
292 views

Problem with Pulse Sensor signal

I'm making alarm with input from pulse sensor. When it detect high heart rate then it send a text message. Everything works fine when i am using potentiometer (as input) for simulating triggering SMS. ...
0
votes
1answer
31 views

How to create objects with their own variables? [closed]

So i created a class and when i created objects and use them, they seem to share their variables between each other ( the currentReading, previousReading and the time variable). how can i create ...
1
vote
0answers
37 views

How to disable the possibility to push activate again a button after being pressed one time [closed]

I have a project of a pill dispenser and I would like to activate the mechanism to let the pills fall down with a button. After being pressed I would like to deactivate the possibility to press ...
0
votes
1answer
331 views

Arduino DC motor with 2 buttons

I have a problem with my Arduino project and I tried everything to fix it but nothing helps. I am trying to rotate my DC motor with two buttons: one button is to stop/start rotating on left side, ...
0
votes
1answer
59 views

How to regulate a led on-board? [closed]

There is blink project consisting 3 sections: 1 - regulation of the led brightness using a potentiometer 2 - whenever: the button is pressed - the led is on - the button is released - the led is ...
0
votes
1answer
168 views

Button to exit a running loop

I have a very basic circuit setup: A button connected to pin 2 An LED connected to pin 9 Desired Functionality: When the button is pressed, the user can toggle through 4 LED patterns. The ...
1
vote
3answers
686 views

Push button control of multiple relays

I'm new to arduinos and have not been able to find/create a working bit of code for my project. I'd like to control several different relays (standard 5v optical relays) with push buttons. I want one ...
0
votes
3answers
138 views

Need help with a program for a button to change the display on an OLED display

So I am programming an OLED display from my Arduino Uno. I am trying to have a button that switches the different words on the display. (The words are just placeholders for programs as of now.) My ...
0
votes
1answer
134 views

Button state issue

Let me preface this by saying I'm a beginner, and I know my code must have some logic errors. I need some fresh eyes on this, I have been messing with it a few days and am just running in circles at ...
0
votes
1answer
145 views

Button Matrix Code and Wiring [closed]

Bear with me here, I'm new to arduinos, so what I'm saying might only make sense in my own mind. I'm trying a button matrix and I not completely sure on my wiring and I have a few questions. Is the ...
0
votes
1answer
279 views

need help in code to send sms to multiple contacts using arduino, gsm800, push button [duplicate]

When button 1 is pressed, the message should be sent to 4 members. But we are receiving the message for one member and after some delay for the other members. But receiving to all members of contacts ...
1
vote
1answer
407 views

Rc car controller using the RC-switch library

simulate this circuit – Schematic created using CircuitLab (Newbie in arduino) Hi so i have a project which involves creating an rc car which uses the 433Mhz rf module and an arduino nano with ...
0
votes
0answers
75 views

Can I manually turn on and off the interrupt timers?

Can I manually control(on and off) the interrupt timers of an Atmega328p chip with a push button? If yes, can it be used in compare match mode or input capture? if someone post some examples then it ...
-1
votes
2answers
79 views

Button Switch arduino

I'm trying to use my button as a switch (the led goes on after I push the button and the led goes off when I push the button again). I know I have the right circuit, because I also used a code from ...
0
votes
1answer
63 views

Power management circuit

i'd like to have a esp-01 powered on and controlled with a push button only. so imagine the device is off, the user press the momentary push button. in the setup the esp8266 turn on a mosfet or ...
0
votes
1answer
240 views

Arduino - Calculating the time for which a Pushbutton is pressed and held without being released

I'm working on a project that requires calculating the time for which a pushbutton is kept pressed without being released. Is there a code snippet that i can use for this particular need ?
0
votes
2answers
518 views

Arduino - Button to start / stop loop

So basically I'm trying to create a device where when I push a button it starts a loop. When I push this button again, it stops the loop. Right now I have it logged to serial. It starts up correctly ...
4
votes
2answers
108 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 ...
0
votes
1answer
3k 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
33 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
33 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
157 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
74 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
673 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
32 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
69 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
44 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
48 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
119 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
25 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
69 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
202 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
52 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
1k 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
0answers
70 views

Arduino debounce understanding

So I have this debounce code. I did some research to learn how this works but I couldn't figure it out. Can someone explain me how this code works? I have basic knowledge of C++. int pinButton = 7; ...