BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Motion Detector issues

esp8266

#1

Have Ive over looked something

Arduino: 1.8.5 (Windows Store 1.8.10.0) (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 4M (1M SPIFFS), v2 Prebuilt (MSS=536), Disabled, None, 115200"

In file included from C:\Users\Admin\Documents\Arduino\libraries\Blynk\src/WidgetRTC.h:14:0,

                 from C:\Users\Admin\Documents\Arduino\libraries\Blynk\src\WidgetRTC.cpp:13:

C:\Users\Admin\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkWidgetBase.h: In member function 'void BlynkWidgetBase::setLabel(Args ...)':

C:\Users\Admin\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkWidgetBase.h:27:9: error: 'Blynk' was not declared in this scope

         Blynk.setProperty(mPin, "label", args...);

         ^

C:\Users\Admin\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkWidgetBase.h: In member function 'void BlynkWidgetBase::setColor(Args ...)':

C:\Users\Admin\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkWidgetBase.h:32:9: error: 'Blynk' was not declared in this scope

         Blynk.setProperty(mPin, "color", args...);

         ^

In file included from C:\Users\Admin\Documents\Arduino\libraries\Blynk\src\WidgetRTC.cpp:13:0:

C:\Users\Admin\Documents\Arduino\libraries\Blynk\src/WidgetRTC.h: In static member function 'static time_t WidgetRTC::requestTimeSync()':

C:\Users\Admin\Documents\Arduino\libraries\Blynk\src/WidgetRTC.h:33:5: error: 'Blynk' was not declared in this scope

     Blynk.sendInternal("rtc", "sync");

     ^

C:\Users\Admin\Documents\Arduino\libraries\Blynk\src\WidgetRTC.cpp: At global scope:

C:\Users\Admin\Documents\Arduino\libraries\Blynk\src\WidgetRTC.cpp:15:20: error: 'uint8_t WidgetRTC::mPin' is not a static member of 'class WidgetRTC'

 uint8_t WidgetRTC::mPin;

                    ^

exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

#2

Please paste in the full sketch. Take care to paste it after three back ticks and cpp. At the end, terminate with 3 back ticks again.


#3
/**************************************************************
 * IoT Motion Detector with Blynk
 * Blynk library is licensed under MIT license
 * This example code is in public domain.
 * 
 * Developed by Marcelo Rovai - 30 November 2016
 **************************************************************/
#include <ESP8266WiFi.h>
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <BlynkSimpleEsp8266.h>
char auth[] = "***********************************";
/* WiFi credentials */
char ssid[] = "*********";
char pass[] = "**********";
/* HC-SR501 Motion Detector */
#define ledPin D7 
#define pirPin D1 // Input for HC-S501
int pirValue; // Place to store read PIR Value
void setup()
{
  Serial.begin(115200);
  delay(10);
  Blynk.begin(auth, ssid, pass);
  pinMode(ledPin, OUTPUT);
  pinMode(pirPin, INPUT);
  digitalWrite(ledPin, LOW);
}
void loop()
{
  getPirValue();
  Blynk.run();
}
/***************************************************
 * Get PIR data
 **************************************************/
void getPirValue(void)
{
  pirValue = digitalRead(pirPin);
  if (pirValue) 
  { 
    Serial.println("==> Motion detected");
    Blynk.notify("T==> Motion detected");  
  }
  digitalWrite(ledPin, pirValue);
}

#4

First… I already fixed your posts with the formatting that was requested of you, and as per the Welcome Topic…

Second… as for your errors… are you sure you have installed the Blynk Libraries properly?

Finaly… do NOT try to run this function call directly from the void loop() which runs hundreds/thousands of times a second… learn about BlynkTimer and use it to call the getPirValue() function…

http://docs.blynk.cc/#blynk-firmware-blynktimer


#5

what do you mean “Take care to paste it after three back ticks and cpp. At the end, terminate with 3 back ticks again.” for some reson I’m not seeing the format issue.


#6

Look at my post… read what I said… follow the links I provided… all will be revealed :stuck_out_tongue_winking_eye:


#7

The Blynk library is installed correct. Ive used another codes and it worked fine. Its just this one. I can used a small code to make the LED function

/* HC-SR501 Motion Detector */
#define ledPin D7 // Red LED
#define pirPin D1 // Input for HC-SR501
int pirValue; // variable to store read PIR Value
void setup() 
{
  pinMode(ledPin, OUTPUT);
  pinMode(pirPin, INPUT);
  digitalWrite(ledPin, LOW);
}
void loop() 
{
  pirValue = digitalRead(pirPin);
  digitalWrite(ledPin, pirValue);
}

This works fine, but I need push notifications.


#8

Compiles well on my system. Check your libraries and/or their locations.


#9

If you are not interested in proper advise, then I will stop advising :stuck_out_tongue_winking_eye: But if you keep posting unformated code, then I may start removing it.


#10

ill check it again… Ive been out of coding for a while and just getting back into it.


#11

https://examples.blynk.cc/?board=ESP8266&shield=ESP8266%20WiFi&example=Widgets%2FPushNotification%2FPushNotification_Button


#12

You must be right about the library issue. Even a example didn’t work. What is strange the wifi scanner example worked.