PUSH BUTTON SWITCH

TINKS022

  1. A push-button is a simple switch mechanism that connects two points in a circuit.
  2.  Buttons are typically made out of hard material, usually plastic or metal.
Features:-
  1. Rated Load: DC 12V 50mA
  2. Mounting Type: Through-hole
  3. Switch Function: Off-Mom
  4. Momentary contact feature, 4 pins, round black push button.
  5. Long useful life.
Applications:-
  1. Used in calculators
  2. Push button appliances
  3. Kitchen appliances, etc.

    

int buttonPin = 2;// choose the input pin (for a pushbutton)

int val = 0;// variable for reading the pin status

 void setup() {

Serial.begin(9600);

pinMode(buttonPin,INPUT);

}

void loop(){

val = digitalRead(buttonPin);

Serial.println(val);

if (val == LOW) {

Serial.println("button pressed");//turn LED on

} else {

Serial.println("button not press");//turn LED OFF

}

delay(1000);

}