This tutorial of Robo India explains how to read digital input through push button on Blynk App using NodeMCU and Robo India Blynk Board.
1. Introduction:
Blynk Board by Robo India is a ready to use board for Inter of things based on Blynk App and NodeMCU. Push button switch is a switch which provides connectivity between its terminals when pressed. When the button is released terminals get disconnected. In this tutorial we will take output on Blynk app by pressing Push Button on Blynk Board.
1.2 Hardware required
Blynk Board and NodeMCU is used in this example. Inset NodeMCU to the Blynk board as shown in the image ahead then connect NodeMCU to PC or Laptop through USB cable.
2. Code the NodeMCU with the following code.
Before uploading, make sure to paste your authorization token into the auth [] variable. Also make sure to load your Wifi network settings into the Blynk.begin(auth, “ssid”, “pass”) function.
Following code may be downloaded from here.
// Robo India Tutorials // Hardware: NodeMCU & BlynkBoard (by RoboIndia) // simple Code for reading value of Push Button #define BLYNK_PRINT Serial #include <ESP8266WiFi.h> #include <BlynkSimpleEsp8266.h> char auth[] = "Yout Auth Key."; // You should get Auth Token in the Blynk App. const int BUTTON = 3; // switch 1 of BlynkBoard Conneted with D9(GPIO 03) pin of NodeMCU char ssid[] = "Your Network Name"; // Your WiFi credentials. char pass[] = "Password"; // Set password to "" for open networks. int BUTTONstate =0; void setup() { Serial.begin(9600); // Debug console Blynk.begin(auth, ssid, pass); pinMode (BUTTON, INPUT); } void loop() { Blynk.run(); }
3. On Blynk App
After the code has been uploaded to the NodeMCU. Following steps are to be performed on Blynk App.
3.1 Create a new project and give it name PushButton and then Select device “NodeMCU”.
3.2 Add widget “Value Display” to read value of Push button.
3.3 Set input Digital pin 9 for D9 of NodeMCU which is connected to Push Button.
3.4 After uploading the Arduino IDE code, press the play button on Blynk app for output.
7. Output
When we press Push Button on Blynk Board, Value on Blynk app will be LOW, and when we release , value will be HIGH.
8. Where to Buy.
Buy on Amazon –
Buy on Robo India – click here
If you have any query please write us at support@roboindia.com
Thanks and Regards
Content Development Team
Robo India
https://roboindia.co