Can't flash my code to the Core

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.

Hello @Escko
It looks like the core is failing to load the new user app and hence reverting back to tinker. This could be simply because the OTA failed, which could happen sometimes. Can you try this a few more times?

1 Like

I’ve succeeded to upload a few times, however it’s a constant pain and frustration. Successful upload ratio is about 1 to 10…

For example now Build says : “Ready.” but I even haven’t seen magenta lights. Sometimes it says: “can’t find core”

Core is breathing cyan. Internet connection is really fast and I’ve checked it many times.

I got today ONE of FIFTY tries working!

can someone invest!

KR

Pitt

also connecting new cores is really a horror since yesterday??

OK, I have to sorry!, It’s the german internet today, that sucks, SORRY AGAIN :sunny:

1 Like