Closed andrewbhennessy closed 7 years ago
The error code you're getting is accurate, pin 8 in fact does not support mode 1.
Let's break down what's happening here. When you create a pin via new five.Pin
and you pass it a pin number, you are creating a digital input pin (this is mode 1). You are passing in SDA
to the pin constructor, which maps to pin 8 under the hood and is an I2C pin. Now here's the thing, as stated in the Raspi IO README, the I2C pins cannot be used for digital input (or output).
It looks like you're trying to use raspi-io to communicate over I2C, so to fix your code all you need to do is delete the line that says new five.Pin('SDA');
so that it looks like this:
var raspi = require('raspi-io');
var five = require('johnny-five');
var board = new five.Board({
io: new raspi()
});
board.on('ready', function() {
board.io.i2cWrite(0x18, 0x5, 'hello');
});
Let me know if this fixes it for you.
Closing for now, since I don't think there's a bug here. Feel free to reopen if you want!
My Code above.
My error's
I think the tutorial code was too generous in saying:
I Found that here:
https://www.npmjs.com/package/raspi-i2c