Skip to content

Instantly share code, notes, and snippets.

@EDISON-SCIENCE-CORNER
Created June 2, 2020 13:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EDISON-SCIENCE-CORNER/1cb4c23208e5361cb2a1f1d08e3f796e to your computer and use it in GitHub Desktop.
Save EDISON-SCIENCE-CORNER/1cb4c23208e5361cb2a1f1d08e3f796e 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[] = "iyP86B47FRFZlAt_XvVdG8EeYewSh34k"; // blynk token
char ssid[] = "edison science corner"; //ssid//password
char pass[] = "eeeeeeee"; //password
int moisture;
int data;
void setup() {
Serial.begin(9600);
pinMode(A0,INPUT);
Blynk.begin(auth, ssid, pass);
}
void loop()
{
Blynk.run();
moisture = analogRead(0); //Read Analog value of first sensor
delay(100);
data = map(moisture,500,1023,100,0);
Serial.print("moisture = "); //to the serial monitor
Serial.print(data );
Blynk.virtualWrite(V5, data ); // to Blynk server
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment