Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
/** | |
****************************************************************************** | |
* @file settings.js | |
* @author David Middlecamp (david@particle.io) | |
* @company Particle ( https://www.particle.io/ ) | |
* @source https://github.com/spark/particle-cli | |
* @version V1.0.0 | |
* @date 14-February-2014 | |
* @brief Setting module | |
****************************************************************************** |
Look at LSB init scripts for more information.
Copy to /etc/init.d
:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
I hereby claim:
To claim this, I am signing this object:
#include "application.h" | |
char number = -1; | |
char maxNumber = 2; | |
bool alt = false; | |
int setNumber(String value) { | |
EEPROM.write(0, value.toInt()); | |
return 0; | |
} |
module['exports'] = function udpateBeachStatus (hook) { | |
var got = require('got'); | |
got('http://hawaiibeachsafety.com/rest/ratings.json') | |
.then(function (response) { | |
hook.res.end(response.body); | |
}) | |
.catch(function (error) { | |
hook.res.end("Error fetching data: " + error); | |
}); | |
}; |
int setBeachStatus(String value) { | |
RGB.control(true); | |
if(value == "green") { | |
RGB.color(RGB_COLOR_GREEN); | |
return 0; | |
} else if(value == "yellow") { | |
RGB.color(RGB_COLOR_YELLOW); | |
return 0; | |
} else if(value == "red") { | |
RGB.color(RGB_COLOR_RED); |
function forecastUrl(apiKey, location) { | |
var apiUrl = "https://api.forecast.io/forecast"; | |
var excludeFields = "exclude=minutely,hourly"; | |
return apiUrl + "/" + apiKey + "/" + location + "?" + excludeFields; | |
} | |
function getForecast(url) { | |
var got = require("got"); | |
return got(url) | |
.then(function (response) { |
module['exports'] = function particle (hook) { | |
var Spark = require('spark'); | |
function output(data) { | |
hook.res.end(JSON.stringify(data, true, 2)); | |
} | |
var token = hook.env.PARTICLE_API_TOKEN; | |
Spark.login({ accessToken: token }). | |
then(function () { |
module['exports'] = function dashboard (hook) { | |
function get(key, callback) { | |
var datastore = hook.datastore; | |
datastore.get(key, function (err, counter) { | |
callback(counter || 0); | |
}); | |
} | |
get('counter', function (counter) { |