Questions tagged [button]
A button is a simple input component which responds to being pushed by a user.
331
questions
0
votes
2
answers
172
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
vote
1
answer
162
views
Button not working - Arduino Due project (MiniEngine v2)
I am building Arduino Due based project called MiniEngine v2 (an open-source motion control software for timelapse photography).
The project is not very active anymore but there are still all the ...
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 ...
1
vote
1
answer
844
views
Loop code without manually pressing the button
In a piece off code I am modifying I have a button connected to start the code and then it resets its self afterwards. Is they a way to make the arduino loop that code without manually pressing the ...
1
vote
1
answer
55
views
Help understanding circuit for button example
I´m working on the button example
.Basically, i don't quite get the use of this connection.
Also, the breadboard i'm using is not quite the ones i see on most tutorials.
is there any 'mapping' i ...
1
vote
0
answers
100
views
my button won't work, why?
I have been trying to get the button to work properly for over a day, but it just won't, can you help me.
The lcd display is for another part of this project, not important at the moment, but I can't ...
-1
votes
1
answer
22
views
I want to make a counter but i don't know what i'm missing or am doing wrong
this is the code i made but it gives me an error about te } and also i need to know how to make delays with this
int ledPin = 4;
int buttonPin=2;
int buttonState = 0; // variable for reading ...
1
vote
2
answers
821
views
LEDs effects changing with a button
So I have a bunch of functions (methods) made and I want to make it so that if the button is clicked (single click) the effects to change... I thought something like:
buttonState = digitalRead(...
0
votes
2
answers
89
views
Button to not run script
I'm looking to have a button that, when pressed down, will mean that the script loaded on the Arduino doesn't run. So far I have:
void setup() {
pinMode(3, INPUT_PULLUP);
if (digitalRead(3) == ...
1
vote
0
answers
103
views
Arduino: wrong digitalRead results from a pullup pin
A button connects GND to PIN where PIN is any digital pin.
I want to catch the moment the button is pressed, so I wrote the following code:
void setup () {
pinMode (PIN, INPUT_PULLUP);
Serial....
2
votes
4
answers
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 ...
1
vote
2
answers
85
views
When a pushbutton and sensor are in a certain state, do something for a certain period of time (15 seconds)
I have a sketch that contains code for an analog input (FSR sensor), a pushbutton, and 6 blinking LEDs.
Currently, the sketch is written to allow the LEDs to blink only when the button is pressed and ...
0
votes
2
answers
141
views
i am unable to make a correct program using the pushbutton to toggle LED on/off?
I want to toggle the the LED on on my first complete click(i.e. pushing and even releasing the pushbutton) and i want to make my LED off at my second click.
This is the program :-
int led = 13;
int ...
0
votes
1
answer
70
views
Get when a button close the circuit
That seems to be a bit stupid to myself but I can't figure out to get to know when my button is pushed (closed) or released (open).
You must know that this not just a simple push button. Actually it ...
1
vote
1
answer
5k
views
How to restart a counter in a program using a push button in a LDR Tripwire setup
So, trying to configure this code so that when I push the button, the person counter will go to zero and just as it goes, the counter will increase when the LDR will get tripped and again when the ...
1
vote
4
answers
6k
views
Button press with Arduino repeated many times
I have 5V -> button -> 10K resistor -> PIN2 setup with Arduino UNO.
My code is very simple:
int count = 0;
void setup() {
pinMode(2, INPUT);
Serial.begin(9600);
}
void loop() {
int state =...
1
vote
1
answer
12k
views
Control a motor with a button
Code:
int motorPin = 9; // the pin the motor is connected to
void setup()
{
pinMode(motorPin, OUTPUT);
}
void loop()
{
motorOnThenOff(); //motorAcceleration
}
void ...
2
votes
0
answers
115
views
How can I call the variable **Servo::write** in Arduino for my 360 servo?
I'm trying to control a Servo with a push button and to help me watching if it is working I am using a LED but I'm not sure if I'm doing it well the Servo::write so I need you to tell me what am I ...
0
votes
1
answer
4k
views
Why is the piezo buzzer not making any sound?
My ciruit:
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
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() {
// ...
0
votes
1
answer
4k
views
Led and button simulation of a blink
My circuit:
My code:
// Pin 13 has a LED connected on most Arduino boards.
// give it a name:
int led = 13;
const int buttonPin = 2; // pushbutton connected to pin 2.
// the setup routine runs once ...
0
votes
3
answers
4k
views
Toggle a led with a switch
My code:
const int buttonPin = 2; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin
bool buttonState = 0; // variable for reading the ...
-4
votes
1
answer
68
views
Need help with my project
Can anyone give me the full code of my project because my code is not working?
My aim is that when the Z axis of an accelerometer is below 370 and a pushbutton connected to a pin 2 becomes high, then ...
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 ...
0
votes
1
answer
442
views
Stop time in Tkinter Stopwatch with a PushButton
So, my main goal is to make a stopwatch with Tkinter, in which time is stoppped with an external pushbutton
My void loop function in Arduino Uno is
void loop() {
if(digitalRead(BUTTON) == HIGH){
...
0
votes
1
answer
2k
views
Reading PushButton status with pyserial
I'm trying to read the status of a PushButton with python via pyserial.
In the loop function of Arduino Uno I have this:
void loop() {
if(digitalRead(BUTTON) == HIGH){
Serial.print("E\n");
while(1){...
0
votes
1
answer
107
views
Bot not activating after button press
This bot is supposed to begin moving forward when the button is pressed, and stop after counting 3 lines of tape on the ground. Currently it is set up to scan the color of the floor at the beginning ...
1
vote
1
answer
81
views
Anything wrong with this code?
Sorry for any grammar mistakes. It's my second language.
I had a little test with my Arduino Uno R3 I connected 2 buttons to power , GND using 10k resistors and pins 2 and 4.
I connected piezo to ...
0
votes
2
answers
164
views
Showing chronometer on PC controlling the begining and end of time by Arduino
I'm really new on this Arduino thing, so I don't know whether what I'm gona ask is feasible or not.
I'd like to make a chronometer in the computer but the controlling button (beginning and end of ...
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 ...
1
vote
2
answers
846
views
How can I make this button toggle the position of a servo?
I am trying to make something so when I press the button it sets the position of the servo to 50 and then when I press it again, it sets it to 150. The button is momentary not a toggle switch. This is ...
2
votes
1
answer
540
views
How do I lock out a push button input with a selectable delay?
I have a program i am working on where a relay is turned on -> waits a delay -> then turns off after either one of two things happen: 1) A set timer is reached OR 2) someone pushes a push button to ...
1
vote
3
answers
4k
views
How can I setup a LED state change with push buttons?
I'm doing a project using Arduino Uno R3 and I'm trying to use two buttons to change LED state between HIGH and LOW. I have already a code but someting its not right because the LED should be starting ...
-2
votes
1
answer
770
views
matrix buttons 8x8
Hi I have 8 buttons on my Arduino uno and I want to create a matrix 8x8 and give each button a row and a column respectively it is not a keypad just 8 buttons each button have a row and a column ex: ...
0
votes
1
answer
94
views
Array variable name changes from readings1 to readings2
I've been using two MB1240 Ultrasonic Sensors with analogRead, and have found that after using bubble sort, the array is found in array readings2, and not readings1. This is important because I would ...
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.
0
votes
1
answer
1k
views
Arduino with two (or more) push buttons
I am trying modify this setup for two push buttons https://www.arduino.cc/en/Tutorial/Button.
The code seems rather trivial
int yellowButtonPin = 2;
int blueButtonPin = 4;
int yellowButtonState = 0;...
1
vote
2
answers
5k
views
How to I press a button once to display text and again to remove it?
My code is displaying voltage and I want to have a button that when pressed it displays a text and when I pressed it again it would turn off the text. I put the word "YES" just for a test
float vPow =...
-5
votes
1
answer
113
views
Arduino Skill Stop Push button error
I made a skill stop game from Arduino Uno and a pushbutton.Here is the code:
byte led_one=2;
byte led_two=3;
byte winner_led=4;
byte led_four=5;
byte led_five=6;
byte pushbutton=12;
byte score=0;
int ...
1
vote
1
answer
625
views
Servo Control using Pushbutton
I was trying to build a system that when the user pushes the button, the servo rotates 45 degrees and than returns back to zero. This system is going to be duplicated as there will be two servos and ...
2
votes
2
answers
299
views
Hold a random number
I am trying to create a code that has at least 6 servos attached and two buttons for a two player game. I want to be able to roll a random number and have it hold that value then when it is that ...
0
votes
2
answers
634
views
digispark - 2 pin push button to iterate through an hashmap
I'm trying to create a project with my digispark where i can iterate through an hashmap, when i press the push button the digispark writes via digikeyboard the values from an hashmap. Each time i ...
1
vote
3
answers
965
views
use button to select variable
i have a need to use 3 buttons a a simple option/variable selector at sketch start up ...
Pretty much at startup , script must wait for button press ( one of 3 ) , when button is pressed , use that ...
1
vote
3
answers
236
views
Help Improving Debouncing
In short, I am attempting to debounce several buttons using something like a while loop instead of delays.
This code runs in a box with a series of buttons on it, if the correct sequence of buttons ...
2
votes
2
answers
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 ...
0
votes
1
answer
63
views
OnKeyPress in a arduino
So, I have 3 buttons to a arduino.
I want to detect the button press on the 3 of them.
For that, i've created a function:
int OnKeyPress (int port) {
int LastState, BeginState, r;
r = 0;
...
2
votes
1
answer
3k
views
Use transistor to press button on external device
I have a small device with a simple push button. I'd like my Arduino to be able to make the device register button pushes. It seems like the best way to do this is to use a transistor to close the ...
1
vote
2
answers
4k
views
How to count the number of button presses then play a sequence?
When I press the button once, sequence s1() plays.
When I press the button twice, sequence s2() plays.
When I press the button thrice, sequence s3() plays.
When I press the button 4 times, sequence s4(...
1
vote
4
answers
7k
views
Why isn't this pushbutton program working?
Here is my circuit:
and here is my code:
int LED = 13;
int BTN = 7;
void setup() {
pinMode(LED,OUTPUT);
pinMode(BTN,INPUT);
}
void loop() {
if(digitalRead(BTN) == HIGH) {
digitalWrite(LED,LOW);
}
...
0
votes
4
answers
2k
views
Can I make so when I press a button on my Arduino Uno board, it will press a key on my computer? [duplicate]
I looked up the question before, but they only gave answers for boards that are not the Uno. Is there any way to make it so when I press a button on my board, it registers as a key press on my ...