// Understandng Push buttons and Pull Up and Pull Down Resistors
// This Code is for Pull up resistor along with Pushbutoon having led along with resistor
int Ledpin=8;
int buttonpin=12; // Read the value
int buttonRead;
int dt = 250;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(Ledpin , OUTPUT);
pinMode(buttonpin , INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
buttonRead = digitalRead(buttonpin);
Serial.println(buttonRead);
delay(dt);
if(buttonRead==1){
digitalWrite(Ledpin , LOW);
}
if(buttonRead==0){
digitalWrite(Ledpin , OUTPUT);
}
}