var tessel = require('tessel'); // import tessel
var gpio = tessel.port['GPIO']; // select the GPIO port
var myPin = gpio.analog[0]; // can be gpio.digital[0-5] or gpio.pin['G3'] through G6
// Turn on the pin
myPin.write(1); // setting ‘true’ has the same effect
// Read the pin
console.log('Reading pin:', myPin.read());
// Turn off the pin
myPin.write(0); // setting ‘false’ has the same effect
// Read the pin
console.log('Reading pin:', myPin.read());
but this doesn't
var tessel = require('tessel'); // import tessel
var gpio = tessel.port['GPIO']; // select the GPIO port
var myPin = gpio.analog[0]; // can be gpio.digital[0-5] or gpio.pin['G3'] through G6
// Turn on the pin
myPin.output(1); // setting ‘true’ has the same effect
// Read the pin
console.log('Reading pin:', myPin.read());
// Turn off the pin
myPin.write(0); // setting ‘false’ has the same effect
// Read the pin
console.log('Reading pin:', myPin.read());
cited error:
/app/scratch.js:5: attempt to call method 'output' (a nil value)
this works
but this doesn't
cited error:
/app/scratch.js:5: attempt to call method 'output' (a nil value)