iitgrad
10/6/2018 - 1:10 PM

WCL - Lab 7

WCL - Lab 7

#include <blynk.h>

bool previousLevel=0;
bool currentLevel=0;

void setup() {
    
    Serial.begin(9600);
    Blynk.begin("a38d6027dede45649462372d51dcf0b70");
    pinMode(D3, INPUT);
    pinMode(D0, OUTPUT);
}

void loop() {
  Blynk.run();
  
  currentLevel = digitalRead(D3);
  digitalWrite(D0, currentLevel);
  if (currentLevel && previousLevel == 0) {
      Serial.println("Motion Detected!");
      //Blynk.notify(“Motion Detected!");
  } 
  previousLevel = currentLevel;
}