Where obviously as you can see the function I created before is not inside. I know that Spark is limited up to create 4 functions, but don’t know if those which are default are include in these limit.
Basically any help would be really appreciated :).
Those four functions are those from the Tinker application. It seems as if somehow the flashing failed. I usually upload a RGB blink in the setup, to ensure it’s new code that is running. The rest of the code seems fine, although I didn’t need the int run_motor(String args); to get it to work. As far as I’m aware, that’s because it isn’t a variable, but I could be mistaken. I’d suggest you use pin D7 for testing, since the onboard LED will light up, giving you a visual indication things are working. That’s why I did, seeing as I don’t have a motor.
Anyhow, here’s my (slightly edited) code, with the LED blink:
void setup() {
Spark.function("rotate", run_motor);
pinMode(D7, OUTPUT);
RGB.control(true);
RGB.color(255,0,0);
delay(200);
RGB.color(0,255,0);
delay(200);
RGB.color(0,0,255);
delay(200);
RGB.control(false);
}
int run_motor(String args) {
digitalWrite(D7, HIGH);
delay(3000);
digitalWrite(D7, LOW);
return 0;
} ```
The Curl looks like this accordingly:
{
“id”: “DEVICE ID”,
“name”: “trochee_ferret”,
“connected”: true,
“variables”: {},
“functions”: [
“rotate”
]
}```
Which has only your function available.
I’d recommend using this for testing CURL stuff, since it’s SO easy, and it already exposes your available functions. You don’t have to worry about the technical stuff, you only have to click a button, which is nice
yea, I think the problem is the same, flashing is going wrong although says me that it was ok, only thing I can test is to prove in other network. Any other ideas to fix this?
Have you tried flashing through USB using the CLI? It’s dead simple, and much faster! Once you get used to it (5 minutes), you’ll never want to go back, unless you’re to lazy to go and pick up your Core Definitely worthwhile checking out.
You could try to flash it again through the IDE. Sometimes it takes a couple of times. Have you installed the deep update (if you’ve got a white Core)? Finally, a factory reset has helped quite some times as well.