DFRobot_Digital_Push_Button_(SKU_DFR0029) - jimaobian/DFRobotWiki GitHub Wiki
Introduction
this is a big button which gives the first touch of the physical world. simply plug to IO expansion board to finish your first taste of Arduino.
Features
- Digital push button sensor
- Easy to 'plug and play'
- Large button keypad and high-quality first-class hat
Pin Definition
Big button module pin definition :
:#Input
:#Power
:#GND
Connection Diagram
Sample Code
///Arduino Sample Code
///www.DFRobot.com
///Last modified on 16th September 2010
int ledPin = 13; // choose the pin for the LED
int inputPin = 3; // Connect sensor to input pin 3
void setup() {
pinMode(ledPin, OUTPUT); // declare LED as output
pinMode(inputPin, INPUT); // declare pushbutton as input
}
void loop(){
int val = digitalRead(inputPin); // read input value
if (val == HIGH) { // check if the input is HIGH
digitalWrite(ledPin, LOW); // turn LED OFF
} else {
digitalWrite(ledPin, HIGH); // turn LED ON
}
}