Can't get my Core to publish()

Have been trying for a number of days now to get my :spark: Core to publish - but it just doesn’t seem to want to.

I have stripped down to a bare metal setup to try to diagnose.

The app I have looks like this:

void setup() {

}

void loop() {
    delay(1000);
    Spark.publish("motion-detected");
}

Which is successfully flashed to my core using the web IDE.

If I try to listen to the events with the following CURL (on Linux)…

curl  -H "Authorization: Bearer 9xxxxxxxxxxxxxxxxxxxxxxxxxxb" https://api.spark.io/v1/devices/events/

I get the following:

:ok

Then occasionally some blank new lines every few seconds.

I also tried using great HTML/Javascript tutorial (https://community.spark.io/t/tutorial-getting-started-with-spark-publish/3422) - but I just get “Waiting for data”.

I’ve copied the Access Token and Device ID directly from the Web IDE.

Am I doing something silly? Please help!

Hi

Have you looked at https://community.spark.io/t/sprint-7-spark-publish-released-lets-build-a-cloud-connected-motion-detector/3391 ? I think that reference conversation will help you.

@markopraakli I had.

Turns out I had a weird problem with my firmware.

I reflashed as per the below and it started working:

Install the missing firmware (can be found here: https://s3.amazonaws.com/spark-website/factory_firmware.bin13 )

dfu-util -d 1d50:607f -a 1 -s 0x00020000 -D factory_firmware.bin
dfu-util -d 1d50:607f -a 0 -s 0x08005000:leave -D factory_firmware.bin 
1 Like

Hmm it shouldn’t be that case since the latest firmware comes with the code you download via Web IDE.

But great you got it working :slight_smile:

1 Like