Blur about how to program Cloud

hello , i’m newbie here. my question is how to transfer data from sensor to web. just for monitoring. my program already can connect to blynk using nodeMCU but i did know how to transfer the data from sensor to cloud.
Below is my program :

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

char auth[] = "my token";
const int sensorPin = D2; 
const int sensorPin1 = A0; 
int sensorState = 0;
int lastState = 0;
 int analogSensor = analogRead(sensorPin1);

void setup()
  Blynk.begin(auth, "wifi name", "my password");
  pinMode(sensorPin, INPUT);
  pinMode(sensorPin1, INPUT);

void loop()

  sensorState = digitalRead(sensorPin);
analogSensor = analogRead(sensorPin1);

if (sensorState == 1 && lastState == 0) {
  Serial.println("WATER detected something PLIS ALERT, send notification");
  Blynk.notify("WATER detected something PLIS ALERT");
  lastState = 1;
//send notification 

  else if (sensorState == 1 && lastState == 1) {
    //do nothing, has not been watered yet
  Serial.println("has not been watered yet");
  else {
    Serial.println("does not need water");
    lastState = 0;

  if (analogSensor > 700)  
   Serial.println("Gas Detected something !! PLIS ALERT, send notification");
  Blynk.notify("Gas Detected something !! PLIS ALERT");


  Serial.println("Nothing happen");

I already sent you a link to the article which you just simply ignored. It has all the information you need to complete your task

Nobody will write a code for you. You need to understand basic principles. Please spend five minutes on trying to understand how Blynk works. This will help you to save hours of frustration after that

1 Like

what do you mean by “cloud” ?
is it blynk cloud or HTML ?

@Fata45 Also, spend the 30 seconds it takes to look back at your first post and see how I edited it to properly format any posted code here :stuck_out_tongue_winking_eye:

And… ohhh… that bad void loop() :open_mouth: NOT Blynk friendly.


sorry i did’t understand

blynk loop :slight_smile:

void loop()

nothing else

thanks bro

1 Like