Dear Particle colleagues. I’ve been trying to use the Spark.publish() feature without success. I don’t know if there’s something wrong with my code, or if my current firmware does not support this (currently using v.0.3.4).
My intention is really simple: to send a short message from Spark and capture it in command line environment with a Ruby script (MacOSX 10.9.5).
On Spark’s side, here’s my code:
void setup() {
}
void loop() {
Spark.publish("publishing_test","Hello.");
}
On the desktop side, here’s the code:
require 'open-uri'
webcontent = open("https://api.spark.io/v1/devices/device_number/events/publishing_test/?access_token=device_token")
content = webcontent.readlines()
puts content
But when I run the Ruby script, all I get is a blank result. I’ve tried to retrieve the published content with Curl, also without success. Any help would be appreciated.