tessel / t1-firmware

[UNMAINTAINED] Tessel 1 Firmware
Other
68 stars 20 forks source link

.output not recognized by analog pins #48

Open Frijol opened 10 years ago

Frijol commented 10 years ago

this works

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)

johnnyman727 commented 10 years ago

I think the fix for this involves throwing a more specific Error when either output or write is used on the ADC pins. What do you think @kevinmehall?