In my project every thing is working fine my hardware is NODE MCU 8266 even with RESTask android app and I try http://blynk-cloud.com/08337e46c7934c22a9c76be90010xxxx/update/V6?value=0 it is working, but when I use RESTful api to change pin state, if I click on call resource the result is invalid token, I ping blynk-cloud.com and i put it is IP in custom ip with port: 8443 and get new token and use it in RESTful still not working. I think it is GEODNS issue but I dont know how to solve it. Please I want help.
???
call resource in HTTP Blynk RESTful APIas shown in image.
It is shown that it is connected to Cowboy server not blynk! I dont know why?
This is my sketch:
// thirtysecondtimer.ino by Costas 12 Dec 2016
//#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h> // library for SimpleTimer
#include <WidgetRTC.h>
#include <TimeLib.h>
//#include<SPI.h>
//bool isFirstConnect = true;
//BLYNK_CONNECTED(){
//if (isFirstConnect){
//Blynk.syncAll();
//isFirstConnect = false;
//}
//}
int Countdown; // Global variable used in Slider widget and runEveryMinute()
boolean pbon;
BLYNK_WRITE(V6){
pbon=param.asInt();
if (pbon==1){
digitalWrite(14,HIGH);}
else {
digitalWrite(14,LOW);
}
}
boolean pbtn;
BLYNK_WRITE(V5){
pbtn = param.asInt();
}
SimpleTimer timer; // define a timer for use by SimpleTimer library
int Gaug;
bool ONstatus = false; // variable to switch device ON and OFF
char auth[] ="08337e46c7934c22a9c76be90010b118";
char ssid[] = "zaatari";
char pass[] = "EC6D0D7xxx";
//char server[] = "188.166.206.43";
WidgetRTC rtc;
BLYNK_WRITE(V0){ // add a slider to your project on V0 range 0 to 30 (minutes)
Countdown = param.asInt(); // set variable as Slider value
Gaug=param.asInt();
}
boolean timr;
BLYNK_WRITE(V4){
timr = param.asInt();
Serial.print("Got a value:");
Serial.print(param.asStr());
}
void clockDisplay()
{
// You can call hour(), minute(), ... at any time
// Please see Time library examples for details
String currentTime = String(hour()) + ":" + minute() + ":" + second();
String currentDate = String(day()) + " " + month() + " " + year();
Serial.print("Current time: ");
Serial.print(currentTime);
Serial.print(" ");
Serial.print(currentDate);
Serial.println();
}
void runEveryMinute(){ // runs every 60s, will do noting when Slider is at zero
if((Countdown > 0)&& (ONstatus == true)){
Countdown--; // reduce Countdown by 1 minute every 60s
Serial.print(F("Device will switch OFF in "));
Serial.print(Countdown);
Serial.println(F(" minute(s)"));
}
if((Countdown > 0) && (ONstatus == false) && (pbon==1)){
Serial.println(F("Device was switched ON"));
ONstatus = true; // to ensure device is only turned ON once
// code here to turn your device ON
digitalWrite(14, HIGH); // send ON signal to relay
}
if((Countdown == 0) && (ONstatus == true)){
Serial.println(F("Device is now OFF"));
ONstatus = false; // to ensure device is only turned OFF once
// code here to turn your device OFF
digitalWrite(14, LOW); // send OFF signal to relay
}
// if(weekday() == 1)
//if(hour()==5)
//if(minute()==46)
//{
if(timr==1)
if(pbtn==1)
{
digitalWrite(14,HIGH);
}
if(((timr==0)||(pbtn==0))&&(pbon==0)&&(Countdown==0))
{
digitalWrite(14,LOW);
}
//else {
//digitalWrite(14, HIGH);
//}
//if(weekday()== 1)
if(hour()==15)
if(minute()==5)
{
digitalWrite(14, LOW);
}
//else {
//digitalWrite(5, HIGH);
//}
//}
Blynk.virtualWrite(V0, Countdown);
Blynk.virtualWrite(V2, Gaug);
}
const int outpt = 14;
WidgetLED led1(V1);
void ldwigt ()
{
boolean outs =(digitalRead(outpt));
if (outs) {
led1.on();
}
else {
led1.off();
}
//BLYNK_WRITE(V1) {
//here you'll get 0 or 255
// int ledValue = param.asInt();
}
void setup()
{
pinMode(14, OUTPUT); // think D5 WeMos is GPIO 14
digitalWrite(14, LOW); // ensure relay is OFF on reboot
Serial.begin(115200);
Blynk.begin(auth,ssid,pass); // this is now a blocking function - more on this later
timer.setInterval(60000L, runEveryMinute); // start the 60s timer function
timer.setInterval(500L, ldwigt);
timer.setInterval(10000L, clockDisplay);
rtc.begin();
}
void loop()
{
Blynk.run();
timer.run(); // Initiates SimpleTimer to ensure the 60s timer keeps running
}
I try this: Blynk.begin(auth,ssid,pass, server);
but the same issue!