I’m having trouble flashing my core from the command line. I’ve created a file named basiclock.ino
The code within the files compiles properly, since i tested it on the web IDE. however, when i try to send it to the spark over cURL, i get a flashing yellow/green light…
here is the command im using (sensitive ID and Token replaced)…and typo fixed
So that removes it being a size issue, and the core not recieving the file or atleast most of it. It still isnt clear if some of the file is perhaps getting lost in transit and rhats why it is failing
Or perhaps there are certain headers or background text added to the firmware what we are unaware of
Just letting you know that I had the same issue. It appears my code was invalid, so it just kept flashing green without warning or whatsoever. Validating it in the web IDE let me find my issue: a file needs the setup and loop function, and to be able to use Spark functions, you need to add an int variable at the top. Kind of a prototype.
—
Nope, I can’t seem to get it to work via the curl method.
I tried flashing via curl from the command line and I have the same problem. It lights up magenta just like it always does while flashing, but then it flashes yellow continuously. This even happened when I uploaded the following bare minimum sketch:
void setup() {}
void loop () {}
with the following command:
curl -X PUT -F file=@blank.cpp https://api.spark.io/v1/devices/$SPARK_CORE_DEVICE_ID?access_token=$SPARK_CORE_ACCESS_TOKEN
I am trying to write a vim function to upload my sketches with a leader command. Does anyone know where this is documented? This thread is the only reference I’ve found to the ability to upload via curl.
Thanks for your quick reply, @Dave. Unfortunately, after many tries, it still doesn’t work via curl. The same code via the web IDE works without flaws and the flashing goes from magenta to green to cyan as expected. Calls to functions in my code work too. So there must be something going on that shouldn’t? The green flashing refers to the internet connection, right? Maybe it resets the SSID and password?
Also, only a factory reset and inputting my credentials make my Core work again. And additionally, I get none of the expected responses. Just this, same as @avidan:
Ahh, sorry, my bad, I think I misunderstood earlier. It looks like the easy endpoint for flashing source directly to your core isn’t behaving as expected. You can still do a “PUT” to /v1/devices/your_core_id with a file, but it needs to be a compiled binary at the moment, and not a source file. I’m guessing the cores are dropping to yellow after the flash because the cloud is diligently flashing text right onto your core…
Thank you for bringing this to my attention, I’ll see if I can’t fix this this weekend, and get you a working example.
I am inserting the correct device id and access token. I am able to use the API to access functions and variables exposed to the cloud so I know my device id and access token are correct.
I have tried changing the URL to my server to verify the file contents are properly sent via the PUT method.
From api.spark.io I am getting an empty reply back and the core is unchanged, never flashes magenta or any other colors.