Hoping to find a little knowledge here. I am trying to learn the Cloud API and need something I can test with CURL as well.
I created a gist so that it would be easy to see the code and error when trying to compile.
I was simply trying to duplicate and slightly modify the brew code in the API reference
Any help is greatly appreciated
bko
May 6, 2014, 8:34pm
2
Hi @ravenna
You have your Arduino String class and normal C char arrays mixed up a bit. The argument to your Spark function is an Arduino String object and you can just use the toInt() method like this:
int Local_Variable;
Local_Variable = num.toInt();
bko
May 6, 2014, 8:35pm
3
One more thing, this tutorial might help too:
Let’s say you have a Spark core with both a Spark variable and a Spark function. In my case, I have the world’s simplest servo control sketch, using the nice miniature servo in the Spark Maker Kit. Using these parts, we will build a servo that you...
Reading time: 18 mins 🕑
Likes: 65 ❤
1 Like
Thanks for the reply @bko using the toInt(num) instead of atoi the responds with this error:
curl_blinker.cpp:8:31: error: ‘toInt’ was not declared in this scope
Any ideas? Do I need to be including a library/header file?
bko
May 6, 2014, 8:42pm
5
Hi @ravenna
It is not a function, but a method. You need to call it like a method num.toInt()
not like a function.
1 Like
Many thanks for the help.
2 Likes