Particle Publish (Photon)

Hey guys:

I’m wanting to publish an event into the dashboard. My code listed below isn’t working as I don’t see any logs being displayed in the dashboard? Is there a firmware requirement or library that I need to include? So the code is to read a button input and toggle the internal LED ON/OFF with the single pushbutton. I want to publish the event each time the button is pressed.

//Title: LED Control
//Created by: Andrew Grimm
//Date: 5/31/16

int LED = D7;
int PB = D1;
bool currentState = FALSE;
bool lastState = FALSE;

void setup() {
    pinMode(LED, OUTPUT);
    pinMode(PB, INPUT);

void loop() {
    currentState = digitalRead(PB);
    Particle.publish("Help", "Test", PUBLIC);
    if (currentState == TRUE & lastState == FALSE)
        digitalWrite(LED, !digitalRead(LED));
        Particle.publish("ButtonPressed!", "Test", PRIVATE);
    lastState = currentState;


No, you don’t need a library or any firmware requirement. You are however, required to limit your publications to 1 per second, which you are not doing. The system may be blocking you since you’re publishing every few microseconds if the if statement is not executed, or every 10 milliseconds if it is executed. From the docs,

NOTE: Currently, a device can publish at rate of about 1 event/sec, with bursts of up to 4 allowed in 1 second. Back to back burst of 4 messages will take 4 seconds to recover.


I changed some code around a bit and still not having any success. I did notice that in the documentation “Particle.publish” appears to turn blue in the web IDE but mine does not. I simplified the code for troubleshooting purposes.

int LED = D7;

void setup() {
    pinMode(LED, OUTPUT);

void loop() {
    digitalWrite(LED, TRUE);
    Particle.publish("Help", "Test", PRIVATE);
    digitalWrite(LED, FALSE);


Do you see the “device came online” or the “status/flash” messages in dashboard for that device when you reset or OTA update?
If not, you might be logged in wrong at the dashboard.
You can also try

particle subscribe mine


I remember having trouble publishing a private event, but I don’t remember exactly what the problem was. The doc do say this,

Publish a private event with the given name, data, and TTL. In order to publish a private event, you must pass all four parameters.

So, try changing your line to the following. If that doesn’t fix it, then the problem is probably with your dashboard.

Particle.publish("Help", "Test", 60, PRIVATE);
1 Like

This info is outdated, there is a three-parameter overload.

And I can see my Photon happily publishing with above code.

I found the problem. I changed from IE into Firefox and then went into the dashboard from there.

IE doesn’t work for my dashboard. I guess there is some plug in’s or something missing. Firefox is working great.