Introduction

This large button gives your Arduino project the first touch of the physical world. Simply plug into the IO expansion board for quick and easy plug and play. Use the button to trigger another sensor, build a gamepad, or anything your imagination can think of!

Feature List

Specification

Connection Diagram

connection diagram

Sample Code

/*
  # Description:
  # When you push the digital button, the Led 13 on the board will turn off. Otherwise,the led turns on.
*/
int ledPin = 13;                // choose the pin for the LED
int inputPin = 2;               // 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
  }
}

Version History

Digital Push Button V1

More Documents

DFshopping_car1.png Get DFRobot Digital Push Button (SKU:DFR0029) from DFRobot Store or DFRobot Distributor.

Turn to the Top