Stack Exchange Network

Stack Exchange network consists of 174 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.

0
votes
0answers
33 views

Stepper Motor Not Running Code

I'm working with an Arduino Mega and I'm trying to run a stepper motor and servo from the same code. There are two buttons: one operates the stepper and the other operates the servo. I'm trying to ...
0
votes
2answers
33 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
51 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
35 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
47 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
58 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
36 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
33 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
46 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
0answers
31 views

Pause and resume logic using single pushbutton

I am able to stop the logic using a pushbutton. However, I would like to pause and also resume with the pushbutton instead of stopping.( When pressed once, pause for 5 min and when pressed gain resume ...
0
votes
1answer
82 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 ...
0
votes
0answers
26 views

Joystick button press misses with reading xy-axis ADC values?

I'm developing the basic function to work with the joystick module, so I have to: 1. Read x-axis ADC value. 2. Read y-axis ADC value. 3. Read the logic button press. The problem is that I misses the ...
1
vote
3answers
175 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
59 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
89 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
56 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
101 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
145 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
48 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
75 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
43 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
113 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
132 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
71 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
0answers
35 views

Push button storing in array and display sequentially without debounce

I would like to read 6pushbutton values from analog0 pin and store it in a array . And print them sequentially My project is to make a bot that could store the input commands (right left forward ...
0
votes
1answer
1k 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
21 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
70 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
60 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
310 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
28 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
65 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
37 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
39 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
83 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
53 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
115 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....
0
votes
0answers
25 views

Why won't this “Simon Says” sketch accept button input?

I tried to create a "Simon Says" game with Arduino, 4 INPUT_PULLUP type buttons and 4 leds. The random sequence generating part apparently does the trick, but the same can't be said for the "input ...
1
vote
1answer
50 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
673 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
56 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; ...
0
votes
1answer
35 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 ...
0
votes
1answer
285 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
43 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
66 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
52 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 ...
-4
votes
1answer
59 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 ...