Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save EDISON-SCIENCE-CORNER/c25139649b266b15d75d602ea3f1c6d9 to your computer and use it in GitHub Desktop.
Save EDISON-SCIENCE-CORNER/c25139649b266b15d75d602ea3f1c6d9 to your computer and use it in GitHub Desktop.
//www.edisonsciencecorner.blogspot.com
//https://www.youtube.com/channel/UCESZHuYTzx0Eyd3yJ8u60Fg
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "M1zi9KAx0C-G7uWRDagqRSyqvjzghd50"; // blynk token
char ssid[] = "edison science corner"; //ssid//password
char pass[] = "eeeeeeee"; //password
int readD1;
int readD2;
int Pin_D1 = 4;
int Pin_D2 = 5;
void setup() {
Serial.begin(9600);
pinMode(Pin_D1,OUTPUT);
pinMode(Pin_D2,OUTPUT);
pinMode(A0,INPUT);
Blynk.begin(auth, ssid, pass);
}
void loop() {
Blynk.run();
//for first sensor
digitalWrite(Pin_D1, HIGH); //Turn D1 On
delay(100);
readD1 = analogRead(0); //Read Analog value of first sensor
digitalWrite(Pin_D1, LOW); //Turn D1 Off
delay(100);
//for second sensor
digitalWrite(Pin_D2, HIGH); //Turn D2 On
delay(100);
readD2 = analogRead(0); //Read Analog value of second sensor
digitalWrite(Pin_D2, LOW); //Turn D2 Off
delay(100);
//to the serial monitor
Serial.print("sensor 1 = ");
Serial.print(readD1);
Serial.print(" / sensor 2 = ");
Serial.println(readD2);
Blynk.virtualWrite(V5, readD1); // to Blynk server
Blynk.virtualWrite(V6, readD2); // to Blynk server
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment