Skip to content

Instantly share code, notes, and snippets.

Created November 7, 2021 06:50
What would you like to do?
[] Part 3 - Display sensor reading using Arduino
[] Part 3 - Display sensor reading using Arduino
- Maker UNO
- Arduino Grove Sensor Kit for Beginner
- Cytron ESP8266 WiFi Shield
- Blynk V1.0.1
Blynk Documentation:
Last Modified: 7 Nov 2021
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
/* Fill-in your Template ID (only if using Blynk.Cloud) */
#define BLYNK_TEMPLATE_ID "YourTemplateID"
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
BlynkTimer timer;
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";
// or Software Serial on Uno, Nano...
#include <SoftwareSerial.h>
SoftwareSerial EspSerial(8, 9); // RX, TX
// Your ESP8266 baud rate:
#define ESP8266_BAUD 9600
#define LED 6
#define LIGHT A3
ESP8266 wifi(&EspSerial);
long prevMillis = 0;
int interval = 1000;
int pinValue = param.asInt();
digitalWrite(LED, pinValue);
// This function sends Arduino's up time every second to Virtual Pin (1).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void myTimerEvent()
// You can send any value at any time.
// Please don't send more that 10 values per second.
int light_adc = analogRead(LIGHT);
Serial.println("Light ADC: " + String(light_adc));
Blynk.virtualWrite(V1, light_adc);
void setup()
pinMode(LIGHT, INPUT);
pinMode(LED, OUTPUT);
// Debug console
// Set ESP8266 baud rate
Blynk.begin(auth, wifi, ssid, pass);
// Setup a function to be called every second
timer.setInterval(1000L, myTimerEvent);
void loop()
{;; // Initiates BlynkTimer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment