Toggle a Tessel Relay module or Pin power On / Off
@ https://github.com/gdibble/tessel-toggle-power @ https://www.npmjs.com/package/tessel-toggle-power
pin
or relay
then try this example:
First set a var for your var togglePowerConfig = use:'pin' pin:pin pinNum:7 ;var togglePower = ;; // Toggle power on a pin or relay; // or togglePower(true) // Manually set power On; // or togglePower(false) // Manually set power Off
togglePowerConfig Options which get bound to fn as shown above^
use: 'relay' // pass: 'relay' or 'pin', defaults to 'relay' pin: pin // pass defined pin or relay, which ever you want used relay: relay // ^ relayChn: 1 // pass: 1 or 2 debug: false // pass: true or false
debug:true
Example shell output from setting ^option -
From running
togglePower(1)
ortogglePower(true)
:togglePower: * Setting pin to 1 * Pin set to 1 2016-05-23T04:17:26.259Z
-
From running
togglePower(0)
ortogglePower(false)
:togglePower: * Setting pin to 0 * Pin set to 0 2016-05-23T04:17:26.674Z
-
From running
togglePower()
:togglePower: * Toggling relay * Relay toggled