/app/index.js:7: attempt to call method 'input' (a nil value)
works as expected.
Digital pin: [ input, rawWrite, readSync, read, pull, output, rawRead, high, once, writeSync, set, toggle, removeListener, pulse, removeAllListeners, mode, setOutput, rawDirection, low, write, pulseIn, readPulse, on, setInput, addListener, setMaxListeners, removeListener, removeAllListeners, on, once, listeners, emit ]
Analog pin: [ write, read, readSync ]
The documentation lists methods like
pin.input()without distinguishing that they only exist in digital pin objects and not analog pin objects.For example, the following script
produces this error
Whereas
works as expected.
Quick check to see the differences in methods: