Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
A button is a simple input component which responds to being pushed by a user.
3
votes
Accepted
Detect button on a ground line (reverse eng)
If the button is not pressed, you will read a HIGH. If the button is pressed you will read a LOW. …
13
votes
Why does this button have a connection to ground?
If you want to simplify you circuit you could instead use a pull-up resistor, and connect the button to ground instead of 5v. … So pin2 will read LOW when the button is pressed, and HIGH when not. To activate the internal pull-up use pinMode(2, INPUT_PULLUP) …
3
votes
Accepted
Getting Push Button Logic To Stick?
You'll need to store whether the button has been pressed.
bool buttonActivated = false;
...
void loop(){
buttonState = digitalRead(buttonPin); //Read push button logic. …
0
votes
Accepted
My button control working in reverse
Here you can see one end of the button is connected to 5 volt, will the other end is connected to a digital input, and via a (pull-down) resistor to ground. … If the button isn't pressed the pull-down resistor will make the input read LOW. If the button is pressed the input will go to 5v (overpowering the pull-down resistor) and the input will read HIGH. …
0
votes
Accepted
Button reading not going off
So try keeping the button pressed for at least 5 seconds.
You probably want to rewrite your code, so the button is more 'responsive'. Below I added an example of how to do this. … increasing, -1 if brightness is decreasing
void setup()
{
pinMode(LED, OUTPUT);
pinMode(BUTTON, INPUT);
}
void loop()
{
/* check the button */
val = digitalRead(BUTTON);
if ((val == HIGH …
1
vote
Breaking a switch case from an ISR
Most of the time this isn't a problem, because code normally runs pretty fast. The problem, most of the time, is the use of delays. What I did was use my own delay function that checks if the expressi …
6
votes
Voltage changes but digitalRead always HIGH
The problem is that when the button isn't pressed, the voltage at pin D3 is just floating. Since there is nothing attached, the voltage at the pin can be anything. … To prevent this, you use a pull-down resistor, so that when the button isn't pressed, the voltage at D3 is pulled to ground, and you will get a LOW using digitalRead. …
0
votes
RGB LED using potentiometer and push button
What I would do is have the button switch between three colors, and have the potentiometer change the brightness of the currently selected color. … Then press the button to select the blue led. Turn it to 100% and the combined color would be a dark purple. Press the button again to select red again. …
0
votes
RGB LED Mode toggle - Trying to avoid using main loop()
As in mode4 this function is called four times, only the current call is skipped if the button is pressed. The following calls are not skipped, because your reset buttonPressed back to false. …
1
vote
Hardware interrupts for buttons not directly assigned to pins
The MCP23017 has two interrupt outputs. The Adafruit shield however doesn't bring out either of those two pins. You could solder a wire between one of these pins and one of the unused arduino-header p …
3
votes
Accepted
Button with switch timer and reset time function + LED feedback. What am I doing wrong?
//CONSTANTS
const int BUTTON_PIN = 2; // Button
const int in1 = 7;
const int greenLED = 4;
const int redLED = 9;
//VARIABLES
int buttonPushCounter = 0; // counter for the number of button presses … int buttonState = 0; // current state of the button
int lastButtonState = 0; // previous state of the button
bool relayOn = false;
//MILLIS
unsigned long previousMillis = 0;
const unsigned …