0.0.4 • Published 10 years ago

gprs-trigger v0.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
10 years ago

Tessel GPRS Trigger This module lets you use your Tessel's GPRS module to make other modules do things. This essentially means that you can text your Tessel and have it execute a function using any module.

var tessel = require('tessel');
var gprslib = require('gprs-sim900');
var relaylib = require('relay-mono');
var gprs = gprslib.use(tessel.port['A']);
var relay = relaylib.use(tessel.port['A']);

var triggerFunction = require('gprs-trigger');
var triggerFunc = new triggerFunction;

var trigger = 'boop';

// The cool thing you want your triggered module to do. In this case, turn something on or off with the relay module.
function coolAction () {
    relay.toggle(1, function (err) {
    if (err) return console.err() 
    if (LOGS) console.log('toggled');
    });
};

// Initialize GPRS module
gprs.on('ready', function() {
    // Wait around 30 seconds for the GPRS modual to connect before sending Tessel a text.
    console.log("GPRS is on and waiting for you to text a trigger for your module");
    triggerFunc.triggerFunc(gprs, trigger, coolAction);
});
0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago