This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
|
oak:tutorials:particle-function [2016/03/24 19:08] jwhendy |
oak:tutorials:particle-function [2016/03/24 19:46] jwhendy [Code] |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ===== Oak: using Particle.variable() ===== | + | ===== Oak: using Particle.function() ===== |
| - | + | ||
| - | [[http://digistump.com/wiki/_media/oak-rgb-led.png|{{http://digistump.com/wiki/_media/oak-rgb-led.png?400}}]] | + | |
| This tutorial is very similar to the one on [[http://digistump.com/wiki/oak/tutorials/particle-variable|Particle.variable()]]. This time, however we will be doing the reverse: //sending// data to the Oak. To accomplish this, we use ''Particle.function()''. As an example, we will send ''POST'' commands using ''curl'' to the Particle API which will control the color of an RGB led connected to the Oak. | This tutorial is very similar to the one on [[http://digistump.com/wiki/oak/tutorials/particle-variable|Particle.variable()]]. This time, however we will be doing the reverse: //sending// data to the Oak. To accomplish this, we use ''Particle.function()''. As an example, we will send ''POST'' commands using ''curl'' to the Particle API which will control the color of an RGB led connected to the Oak. | ||
| Line 207: | Line 205: | ||
| Particle.function("set", set_rgb); | Particle.function("set", set_rgb); | ||
| | | ||
| - | // we'll configure the on-board LED to blink | + | // initialize each color pin as an output |
| - | // this is handy for simply making sure the Oak is running your sketch | + | |
| pinMode(6, OUTPUT); | pinMode(6, OUTPUT); | ||
| pinMode(7, OUTPUT); | pinMode(7, OUTPUT); | ||