Using Blynk 0.4.6
Arduino IDE 1.8.1
Arduino Uno R3 w ESP8266-01 firmware 1.5.4 (AiThinker_ESP8266_DIO_8M_8M_20160615_V1.5.4.bin)
Hello,
I’d like some more control over testing if the wifi connection has dropped and/or Blynk server connection has dropped.
I’ve read this forum topic to get started.
The problem I am having is: Blynk.config(auth);
is throwing error: no matching function for call to 'BlynkWifi::config(char [33])'
Relevant code snippets:
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#include "WiFiEsp.h"
char auth[] = "<my 33 char token value>";
Blynk.config(auth);
I see the code does have this function call with this signature…so what else could be the problem?
void config(const char* auth,
const char* domain = BLYNK_DEFAULT_DOMAIN,
uint16_t port = BLYNK_DEFAULT_PORT)
{
Base::begin(auth);
this->conn.begin(domain, port);
}
Full Code:
/*
WiFiEsp example: ConnectWPA
This example connects to an encrypted WiFi network using an ESP8266 module.
Then it prints the MAC address of the WiFi shield, the IP address obtained
and other network details.
For more details see: http://yaab-arduino.blogspot.com/p/wifiesp-example-connect.html
*/
#include "WiFiEsp.h"
#include <BlynkSimpleShieldEsp8266.h>
// Emulate Serial1 on pins 6/7 if not present
#ifndef HAVE_HWSERIAL1
#include "SoftwareSerial.h"
SoftwareSerial Serial1(2, 3); // RX, TX
#endif
char ssid[] = "myssid"; // your network SSID (name)
char pass[] = "mypwd"; // your network password
int status = WL_IDLE_STATUS; // the Wifi radio's status
char auth[] = "11111111111111111111111111111111";
void setup()
{
// initialize serial for debugging
Serial.begin(9600);
// initialize serial for ESP module
Serial1.begin(9600);
// initialize ESP module
WiFi.init(&Serial1);
// check for the presence of the shield
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue
while (true);
}
// attempt to connect to WiFi network
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to WPA SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network
status = WiFi.begin(ssid, pass);
}
Serial.println("You're connected to the network");
Blynk.config(auth); // in place of Blynk.begin(auth, ssid, pass);
Blynk.connect(10000); // timeout set to 10 seconds and then continue without Blynk
while (Blynk.connected() == false) {
// Wait until connected
}
Serial.println("Connected to Blynk server");
Serial.print("Is Blynk Connected? ");
Serial.println(Blynk.connected());
}
void loop()
{
bool isconnected = Blynk.connected();
if(isconnected)
{
Blynk.run();
} else {
Serial.println("Blynk not connected in loop :(");
}
// print the network connection information every 10 seconds
// Serial.println();
// printCurrentNet();
// printWifiData();
//
// delay(10000);
}
void printWifiData()
{
// print your WiFi shield's IP address
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
// print your MAC address
byte mac[6];
WiFi.macAddress(mac);
char buf[20];
sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X", mac[5], mac[4], mac[3], mac[2], mac[1], mac[0]);
Serial.print("MAC address: ");
Serial.println(buf);
}
void printCurrentNet()
{
// print the SSID of the network you're attached to
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
// print the MAC address of the router you're attached to
byte bssid[6];
WiFi.BSSID(bssid);
char buf[20];
sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X", bssid[5], bssid[4], bssid[3], bssid[2], bssid[1], bssid[0]);
Serial.print("BSSID: ");
Serial.println(buf);
// print the received signal strength
long rssi = WiFi.RSSI();
Serial.print("Signal strength (RSSI): ");
Serial.println(rssi);
}
Thanks in advance,
Chad