This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
oak:tutorials:particle-function [2016/03/24 19:46] jwhendy [Code] |
oak:tutorials:particle-function [2016/05/27 01:30] (current) pfeerick edited to hopefully reduce confusion on how Particle.function is used in code |
||
---|---|---|---|
Line 26: | Line 26: | ||
This function creates an interface between your Oak and particle.io. We create a function with a given name, and then access that named function via ''curl'' commands, passing along a value with it. On the Oak side, it finds the function with that name, and then runs it with the value that was passed. | This function creates an interface between your Oak and particle.io. We create a function with a given name, and then access that named function via ''curl'' commands, passing along a value with it. On the Oak side, it finds the function with that name, and then runs it with the value that was passed. | ||
- | The syntax looks like this: | + | The syntax looks like ''Particle.function("name", function_name)'', and you then have a function that look like the below example, which is run when the function is triggered. You would normally place the ''Particle.function'' command in the setup() portion of your code. Have a look at the example sketch at the bottom of the page to better understand how function is used. |
<code> | <code> | ||
- | Particle.function("name", function_name) | ||
- | |||
int function_name(String arg) | int function_name(String arg) | ||
{ | { |