Skip to content

Instantly share code, notes, and snippets.

@mbence
Created December 5, 2017 21:03
Show Gist options
  • Save mbence/588d189a30323fa8c28b3890418c9621 to your computer and use it in GitHub Desktop.
Save mbence/588d189a30323fa8c28b3890418c9621 to your computer and use it in GitHub Desktop.
Blynk login timeout problem
/*************************************************************
Arduino Nano with optiboot and ESP8266 in AT mode
Login timeout problem
*/
#define BLYNK_PRINT Serial
#include <BlynkSimpleShieldEsp8266.h>
#include <ESP8266_Lib.h>
#include <SoftwareSerial.h>
const char auth[] = "";
const char ssid[] = "";
const char pass[] = "";
const char host[] = "";
SoftwareSerial EspSerial(4, 2); // RX, TX
ESP8266 Wifi(&EspSerial);
BlynkTimer timer;
// I only define timer2 to use up a lot of memory.
// Without the second timer, the sketch only uses 56% memory and its working correctly
// Uncommenting this line rises the memory useage to 71% and the login time out problem occurs
//BlynkTimer timer2;
void setup()
{
Serial.begin(9600);
EspSerial.begin(9600);
delay(10);
Blynk.begin(auth, Wifi, ssid, pass, host);
delay(200);
timer.setInterval(10000, requestTime);
}
void loop()
{
Blynk.run();
timer.run();
}
void requestTime() {
Serial.println("Requesting time");
Blynk.sendInternal("rtc", "sync");
}
BLYNK_WRITE(InternalPinRTC) {
unsigned long blynkTime = param.asLong();
Serial.print("Time sync: OK ");
Serial.print(blynkTime);
Serial.println();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment