Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
aboda243
Published

Button checker

Checks if the button is working right

BeginnerFull instructions provided232
Button checker

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Tactile Switch, Top Actuated
Tactile Switch, Top Actuated
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Schematic:

circuit:

Code

the full code:

Arduino
download and use it!
#define buttonPin 2
#define ledPin 13
bool state = 0;
bool lastRead = 0;
void setup() {
 // put your setup code here, to run once:
Serial.begin(9600);
pinMode(2,INPUT);
pinMode(13,OUTPUT);
}
void loop() {
 // put your main code here, to run repeatedly:
state = digitalRead(2);
if(state != lastRead)
{
 Serial.println(state);
digitalWrite(ledPin,state)
 lastRead = state;
}
}

Credits

aboda243
2 projects • 2 followers
Contact

Comments

Please log in or sign up to comment.