-
Notifications
You must be signed in to change notification settings - Fork 13.3k
PubSub missing #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The original one was reported to work fine. |
I thought I had it there - compiles ok, publishes ok, subscribes ok but will not take any notice of subscribed topics - and if you keep firing subscribed topics at it, the program eventually dies. Here's my modified test - I even used millis() in case the 5 second delay was causing problems - made no difference... #include <PubSubClient.h> void* __dso_handle; const char* ssid = "loft-east"; char* topic = "blah"; unsigned long mymillis; WiFiClient wifiClient; void callback(char* topic, byte* payload, unsigned int length) { String macToStr(const uint8_t* mac) void setup() { Serial.println(); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { // Generate client name based on MAC address and last 8 bits of microsecond counter Serial.print("Connecting to "); if (client.connect((char*) clientName.c_str()),"admin","mypass") {
} void loop() { if (mymillis<millis()) if (client.connected()){
} Any ideas? |
oh, you need to call client.loop(); from your loop function for the
|
Right – that accounts for a lot – thanks for the speedy response – that appears to work a treat. Presumably my use of millis() is the right solution as a 5 second delay would similarly stop incoming responses. Shame the incoming subs can’t be done under interrupt… From: Ivan Grokhotkov [mailto:[email protected]] oh, you need to call client.loop(); from your loop function for the
— |
There's a standard Arduino library, called Time, which can make stuff like "call this from a loop every N seconds" easier. |
You are a life-saver – indeed that is of course correct and that now works.. But I’ve now found another issue…. While I was experimenting I realised my MQTT broker didn’t have security (something to do with a second mosquito.conf and an include that didn’t work)… and in the process of getting THAT working – which it does perfectly I’ve realised that…. if (client.connect((char*) clientName.c_str()),"my_username","my_password") { Doesn’t work. It does not matter what username and password I put in there it SAYs it has connected – but now will not publish (and rightly so)… Any ideas? From: Ivan Grokhotkov [mailto:[email protected]] oh, you need to call client.loop(); from your loop function for the
— |
Frankly I've never tried using PubSubClient with auth... Need to On Fri, Apr 3, 2015 at 12:29 PM, scargill [email protected] wrote:
|
Doooohhhh. Parentheses… Wrong.. if (client.connect((char*) clientName.c_str()),"my_username","my_password") { Right.. if (client.connect((char*) clientName.c_str(),"my_username","my_password")) { It works! From: Ivan Grokhotkov [mailto:[email protected]] Frankly I've never tried using PubSubClient with auth... Need to On Fri, Apr 3, 2015 at 12:29 PM, scargill <[email protected] mailto:[email protected] > wrote:
— |
Be more clear about PubSubClient Close #38 [ci skip]
PubSub appears to be missing from the libraries and the original pubsub won't compile.
The text was updated successfully, but these errors were encountered: