Trying a simple function to return a number + number

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

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();

One more thing, this tutorial might help too:

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?

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.