// select wpi pin 0 = pin 11 on header (for v2)
var pin = 5;
// initialise the wpi to use the global context
var wpi = context.global.wpi;
// use the default WiringPi pin number scheme...
wpi.wiringPiSetup();
// initialise the state of the pin if not already set
// anything in context. persists from one call to the function to the next
context.state = context.state || wpi.LOW;
// set the mode to output (just in case)
wpi.pinMode(pin, wpi.OUTPUT);
// toggle the stored state of the pin
(context.state == wpi.LOW) ? context.state = wpi.HIGH : context.state = wpi.LOW;
// output the state to the pin
wpi.digitalWrite(pin, context.state);
// we don't "need" to return anything here but may help for debug
return msg;