Difference between revisions of "LinkNode 12mm Button Module"
(Created page with "== Introduction == This button module hosts momentary push button switch - 12mm Square. It can serve as input for Xduino experiment. ( Press the button output low level ) ...") |
(No difference)
|
Latest revision as of 02:27, 13 December 2016
Introduction
This button module hosts momentary push button switch - 12mm Square. It can serve as input for Xduino experiment. ( Press the button output low level )
Wiring & Running
The Button module is connected to the base shield J1:
Button Signal --> LinkNode D1 G0
Open the Arduino IDE serial monitor ( BAUD 9600 ) , you can see the button state .
Simple Code
const int ButtonPin=0; int press_count = 0; void setup() { pinMode(ButtonPin, INPUT); Serial.begin(9600); // init serial to 9600b/s Serial.println("The Button is connected to the G0 (LinkNode D1)"); } void loop() { int sensorValue = digitalRead(ButtonPin); if(sensorValue==0) { delay(10); if(sensorValue==0) // Check if the button is pressed { press_count++; Serial.print("The button is pressed , count:"); Serial.println(press_count,DEC); } delay(200); } }