Ks0112 keyestudio EASY plug Digital Push Button

From Keyestudio Wiki
Jump to: navigation, search
Keyestudio EASY plug Digital Push Button

Introduction

The EASY Plug Push-button module is a tidy little design that lets you control a DC power source using an everyday tactile button.
This basic application module is widely applied to Arduino, Raspberry Pi platforms.
When the button is pressed, it outputs HIGH level signal; if release the button, it outputs LOW level signal.
You can simply connect to an IO port to have your first taste of Arduino.
Note: this sensor needs to be used together with EASY plug control board.


Specification

  • Connector: Easy plug
  • Supply Voltage: 3.3V to 5V
  • Large button and high-quality top cap
  • Sensor type: Digital


Technical Details

  • Dimensions: 38mm*20mm*18mm
  • Weight: 5.6g


Connect It Up

Connect the EASY Plug Push Button sensor to control board using an RJ11 cable. Then connect the control board to your PC with a USB cable.
thumb


Upload the Code

Copy and paste below code to Arduino IDE and upload.

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


What You Should See

Powered up and upload well the code, press down the button, D13 indicator on the control board is turned on. While release the button, indicator LED is off.
thumb thumb


Resources

Download the PDF:
https://drive.google.com/open?id=1n231PI2jg8BQcIFIccbpYRfGLHEpQoP0



Buy from