[SOLVED]Doing something wrong with Particle.subscribe or something is broken

So I was writing some firmware using Particle.subscribe and it wasnt working so I fell back to some super simple test firmware here:

void setup() {
    Particle.subscribe("WhatASuperUniqueEventMame", myHandler);
}

void loop() {

}

void myHandler(const char *event, const char *data){
    Serial.println("Handled");
}

Screen shot of published event on dashboard:

No print to serial terminal from module. Ideas? Am I nuts? Is something down? status.particle.io says everything is up and Particle.function calls are working.

I think you missed.
Serial.begin(9600);
or whatever speed you want.

3 Likes

No. I actually haven’t used Serial.begin() in a while. Doesn’t seem to be necessary anymore if you are monitoring through the USB connection. I went ahead and added it for good measure but no effect.

void setup() {
    Serial.begin(115200);
    Particle.subscribe("WhatASuperUniqueEventMame", myHandler);
}

void loop() {

}

void myHandler(const char *event, const char *data){
    Serial.println("Handled");
}

Are you using particle monitor from the CLI or a straight up terminal session with the photon?
I checked a subscribe I use and it is working fine for me.

Yeah, I am using particle serial monitor from the CLI. I print a test message in this firmware and I get that but nothing else.

void setup() {
    Particle.subscribe("WhatASuperUniqueEventMame", myHandler);
    Serial.println("Test Print");
}

void loop() {

}

void myHandler(const char *event, const char *data){
    Serial.println("Handled");
}

Really stumped on this one.

How do you publish?

If you are publishing PRIVATE you have to subscribe MY_DEVICES.

1 Like

Well @ScruffR as usual you are right on the money. I am using our web app Mobicle.io to publish the event. Turns out we had the Publish Event function setting it to private. I added MY_DEVICES to the Particle subscribe function and viola working now! I totally missed that.

Thanks!

3 Likes