Re: publishing variables to MQTTBOX
Posted:
Mon Jan 08, 2018 11:54 am
by schufti
the problem is clear:
client.publish();
awaits two (pointers to) character arrays as arguments (as the errormessage clearly states), but you tried to pass one integer (buttonPushCounter) and I foolishly assumed it might also take string.
so maybe sth like
Code: Select allmsg = itoa(buttonPushCounter,msg,10)
client.publish("OsoyooDataF",msg);
may actually work ...
Re: publishing variables to MQTTBOX
Posted:
Mon Jan 08, 2018 7:10 pm
by Gdipstick
thanks for the advice, but it seems like it's conflicting with an assignment at the beginning of the sketch...
char msg[50];
how can we reconcile this?
Arduino: 1.8.2 (Windows 7), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)"
C:\Users\GADAWE\Documents\Arduino\node_ct_rgb_box\node_ct_rgb_box.ino: In function 'void loop()':
node_ct_rgb_box:136: error: incompatible types in assignment of 'char*' to 'char [50]'
msg = itoa(buttonPushCounter,msg,10);
^
exit status 1
incompatible types in assignment of 'char*' to 'char [50]'
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Re: publishing variables to MQTTBOX
Posted:
Tue Jan 09, 2018 3:42 am
by gdsports
The assignment is not needed.
Code: Select allitoa(buttonPushCounter,msg,10)
client.publish("OsoyooDataF",msg);
Re: publishing variables to MQTTBOX
Posted:
Tue Jan 09, 2018 6:04 pm
by Gdipstick
works like a charm!
so much to learn about coding.... my have some follow up Qs to clean up and stabalize the experiment, but otherwise it's working!!!
thanks again!