Hi guys,
I’ve just received my Core and currently testing it.
Everything went well (core claimed, connected to wifi, cyan breathing, tinkered) until I wrote my first code and tried to flash it to the core. Here it is:
void setup()
{
Spark.function("double", dbl);
}
void loop() {}
int dbl(String n)
{
int c = n.toInt()*2;
return c;
}
Then I click Verify, Save and everything seems to work. However after I hit Flash, Core blinks with magenta for some period, sometimes it becomes solid magenta, sometimes not. After this finishes - led restores to breathing cyan. IDE says "Ready."
When I try:
curl https://api.spark.io/v1/devices/xxxxxxxxxxxxxxxxxxxxxxx/double \
-d access_token=xxxxxxxxxxxxxxxxxxxxxxxx \
-d "16"
I get "error": "Function not found"
.
When I try:
curl 'https://api.spark.io/v1/devices/xxxxxxxxxxxxxxxxxxxxxxx?access_token=xxxxxxxxxxxxxxxxxxxxxxxx'
I’m getting:
{
"id": "XXXXXXXXXXXXX",
"name": "XXXXXXXX",
"variables": [],
"functions": [
"digitalread",
"digitalwrite",
"analogread",
"analogwrite"
]
}
I assume that I just can’t flash my code to the core since Tinker App is working and I can make successful calls like:
curl https://api.spark.io/v1/devices/XXXXXXXXXXXXXXXX/digitalwrite \
-d access_token=XXXXXXXXXXXXXXXXXXXXXX
-d params=D7,HIGH
Please help me understand what’s wrong and how to fix that. If there is an issue in the communication library or in any other, how can I update them? I’m a bit new to all this stuff, however with some guidance I can handle it.
Thanks.