DSC
July 12, 2016, 9:44am
1
Why is this failing during compile?
vars ------------
char arduino_mac[] = { 0x5C, 0xCF, 0x7F, 0x00, 0x7A, 0x2E };
char auth[] = “xxxxf”;
Using library build 3.8
/Users/Danielcopeland/Documents/Arduino/tempmaster_mqtt/tempmaster_mqtt.ino: In function ‘void setup()’:
tempmaster_mqtt:113: error: invalid conversion from ‘int’ to ‘const char*’ [-fpermissive]
Blynk.begin (auth, "blynk-cloud.com ", 8442, arduino_mac);
^
In file included from /Users/Danielcopeland/Documents/Arduino/tempmaster_mqtt/tempmaster_mqtt.ino:4:0:
/Users/Danielcopeland/Documents/Arduino/libraries/Blynk/BlynkSimpleEsp8266.h:66:10: error: initializing argument 3 of ‘void BlynkWifi::begin(const char*, const char*, const char*, const char*, uint16_t)’ [-fpermissive]
void begin(const char* auth,
^
exit status 1
invalid conversion from ‘int’ to ‘const char*’ [-fpermissive]
hard to know if you don’t post up some proper code???
DSC
July 12, 2016, 10:07am
3
Please refer to blynk.begin woes… I am using the syntax that has been suggested.
Costas
July 12, 2016, 10:08am
4
@Dave1829 on this occasion the small code snippet might be enough because of the detailed error message.
@DSC
The error message indicates BlynkWifi::begin takes 5 arguments, 4 being const char and 1 being an integer. It further states you are trying to convert from an integer to const char which the compiler is not accepting. I know @vshymanskyy provided you with the following snippet a few days ago so you would think it is ok.
Byte arduino_mac [] = {0xDE, 0xED, 0xFE, 0xBA, 0xAE, 0xEF};
Blynk.begin (auth, "blynk-cloud.com ", 8442, arduino_mac);
Version 0.3.8 of Blynk’s library that you are using now has the following feature:
Auto-generate Ethernet MAC address based on Auth Token
Might be worth you rolling back to 0.3.7 to see if your sketch still compiles ok.
1 Like
Costas
July 12, 2016, 10:13am
5
Error message states argument 3 is the problem which I believe is the 8442. Just guessing here but maybe it should be “8442”?
DSC
July 12, 2016, 10:17am
6
Thank you for looking into this. Please give me the correct syntax for blynk.begin for version 3.8 so we can nail this down.
Costas
July 12, 2016, 11:04am
7
@DSC I don’t know the correct syntax and I am still using 0.3.7.
I notice in the other thread @vshymanskyy stated:
Byte arduino_mac [] = {0xDE, 0xED, 0xFE, 0xBA, 0xAE, 0xEF};
For 0.3.7 if you correct Byte to byte then it fails to compile, again with argument 3 being the problem but the full error message does show the 4th argument as IPAddress whereas it appears to be const char* in 0.3.8.
error: initializing argument 3 of 'void BlynkWifi::begin(const char*, const char*, const char*, IPAddress, uint16_t)
Changing byte to char for the MAC address, as you have it, still gives argument 3 error (which it would as the MAC is the fourth argument.
As I suggested “8442” does compile (in 0.3.7) but I don’t know if it is the correct syntax, for 0.3.7 or 0.3.8.
I’m not planning to move to 0.3.8 just yet but you could try:
Blynk.begin (auth, "blynk-cloud.com ", "8442", arduino_mac);
If it fails provide the error message and hopefully @vshymanskyy will provide the correct syntax in due course for 0.3.8.
you didn’t think that posting a follow-up in the existing thread made more sense than starting a new thread and referring people back to to a previous thread?
DSC
July 12, 2016, 12:37pm
9
Sometimes people need a fresh look at an old problem… this was mark solved, and I am still having problems. I need version 3.8 because I have two projects that I would like to get off the ground. In trying to establish the second, it blew the first one out of the water. I worked many hours trying to get back to where I was. I know that you are going through transitions in improving blynk. I do appreciate that … and applaud you in a great product.
mate, i dont work for Blynk, hardly anyone who posts here does, we are all Blynk users who try to help each other out…
but when a new thread appears, with such abnormal kinda phrasing, it is hard not to comment on it…
sorry i cant help you, but going back to the original thread might have been a better idea… (for future reference)
but regardless, @Costas has provided his wisdom and also alerted the Blynk personnel to your issue, (so it should be sorted soon )
DSC
July 12, 2016, 12:50pm
11
I am new to posting … thanks for your help!!!
2 Likes
Here are all of the variants of begin parameters for Ethernet connection and 0.3.8 library:
// DHCP with domain
void begin( const char* auth,
const char* domain = BLYNK_DEFAULT_DOMAIN,
uint16_t port = BLYNK_DEFAULT_PORT,
const byte mac[] = NULL)
// Static IP with domain
void begin( const char* auth,
const char* domain,
uint16_t port,
IPAddress local,
IPAddress dns,
const byte mac[] = NULL)
// Static IP with domain, gateway, etc
void begin( const char* auth,
const char* domain,
uint16_t port,
IPAddress local,
IPAddress dns,
IPAddress gateway,
IPAddress subnet,
const byte mac[] = NULL)
// DHCP with server IP
void begin( const char* auth,
IPAddress addr,
uint16_t port = BLYNK_DEFAULT_PORT,
const byte mac[] = NULL)
// Static IP with server IP
void begin( const char* auth,
IPAddress addr,
uint16_t port,
IPAddress local,
const byte mac[] = NULL)
// Static IP with server IP, DNS, gateway, etc
void begin( const char* auth,
IPAddress addr,
uint16_t port,
IPAddress local,
IPAddress dns,
IPAddress gateway,
IPAddress subnet,
const byte mac[] = NULL)
1 Like
Costas
July 12, 2016, 1:47pm
13
@DSC does the post by @vshymanskyy help?
I only really use WiFi so I have little knowledge of the Ethernet syntax but I believe you require byte for the mac (not char) and the port is ok as 8442 not “8442”.
If you still have problems please post your sketch with </> formatting.
with 0.3.8 - it should be safe just to skip mac setting
DSC
July 14, 2016, 12:34am
15
I appreciate the feedback and response to my questions. I now have two projects that are running concurrently. I am using ver 3.8 . I have only been able to use blynk.begin(auth, ssid, password) in connecting up to blynk cloud. One of the problems w blynk begin getting confused … The order of including libraries, and the usage of implementing them. I finally found the correct order and everything is working. Thanks again!
Costas
July 14, 2016, 5:55am
16
@DSC could you please explain how your systems are configured (WiFi, Ethernet, WiFi and Ethernet or some other combination). Could you also post an extract showing the libraries and Blynk.begin() syntax for your particular configuration.
DSC
July 14, 2016, 5:17pm
17
Am using Esp8622 Huzzah feather with data logger (clock and SD). Did not have to include ESP8266WiFi.h ... I don't know why. Another library enables the network somehow.
#define BLYNK_PRINT Serial
//#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <BlynkSimpleEsp8266.h>
#include <SD.h>
#include <Wire.h>
#include "RTClib.h"
File myFile;
#define sdSelect 15
char auth[] = "xxx";
char ssid[] = "xxx";
char password[] = "xxx";
char mqtt_server[] = "192.168.1.31";
char data[40];
float rcvdtemp=0;
long time_now = 0;
long t_alarm = 0;
long t_loop = 0;
char temp[20];
float set_temp = 79.5;
float set_lower = 0;
float set_upper = 0;
bool temp_mode=1;
float min_temp = 0;
float max_temp = 0;
bool initial = 0;
char timestr[20];
char *i_timestr=timestr;
char datestr[20];
char *i_datestr=datestr;
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};
int dayoftheweek = 0;
int oldhour=0;
int temp_day = 0;
int temp_hr = 0;
int temp_min = 0;
int temp_val = 0;
long unix_value= 0;
long unix_midnight = 0;
long calc_midnight = 0;
char wkday[4];
int period=0;
bool notif = 0;
long now=0;
bool tog = 0;
const int testled2 = 12;
const int testled1 = 14;
byte arduino_mac[] = { 0x5C, 0xCF, 0x7F, 0x00, 0x7A, 0x2E };
bool init_r = 0;
//char alarm[20];
WiFiClient esptmstr;
PubSubClient client(esptmstr);
//RTC_PCF8523 rtc;
RTC_Millis rtc;
WidgetTerminal terminal(V6);
void setup() // ---------------------- setup -------------
{
Serial.begin(9600);
Serial.println(" ");
pinMode(testled1,OUTPUT);
pinMode(testled2,OUTPUT);
digitalWrite(testled1, LOW);
digitalWrite(testled2, LOW);
Serial.println("Connecting to Blynk..");
Blynk.begin(auth, ssid, password);
bool isFirstConnect = true;
while (Blynk.connect() == false)
{
// Wait until connected
}
Serial.println("Blynk is Connected!");
rtc.begin(DateTime(F(__DATE__), F(__TIME__)));
// rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
// rtc.adjust(DateTime(2016, 7, 2, 8, 00, 0));
// rtc.adjust(DateTime(2016, 7, 3, 22,25, 0));
// Yr M D H M S
Serial.print("Initializing SD card...");
if (!SD.begin(15))
{
Serial.println("initialization failed!");
return;
}
Serial.println("initialization done.");
DateTime now = rtc.now();
client.setServer(mqtt_server, 1883);
client.setCallback(callback);
delay(3000);
} // --------------------------------- End of Setup ----------
void loop() // ===========================================
{
Blynk.run();
DateTime now = rtc.now();
time_now = millis();
if (!client.connected())
{ // If Not Connected..
reconnect();
}
client.loop();
if (time_now - t_loop > 1000)
{
t_loop = time_now;
tloops();
}
} // ---------- end of loop ------------
void callback(char* topic, byte* payload, unsigned int length) {
int x = 0;
for (int i = 0; i < length; i++) {
data[x] = payload[i];
x++;
}
data[x] = '\0';
if (strcmp(topic, "mqtt/temp/t1") == 0) // temp readings
{
t1_rcv();
}
if (strcmp(topic, "mqtt/temp/t2") == 0) // temp readings
{
t2_rcv();
}
if (strcmp(topic, "mqtt/temp/settemp") == 0) // temp readings
{
settemp_rcv();
}
memset(data,0,sizeof(data));
}
void reconnect() {
// Loop until we're reconnected
while (!client.connected()) {
Serial.print("Attempting MQTT connection...");
// Attempt to connect
if (client.connect("esptmstr")) {
Serial.println("connected");
client.subscribe("mqtt/temp/#");
} else {
Serial.print("failed, rc=");
Serial.print(client.state());
Serial.println(" try again in 5 seconds");
// Wait 5 seconds before retrying
delay(5000);
}
}
}
you need to post your code with CODE tags so it is readable.