Vuzi / raspi-sensors

Deprecated - Nodejs C++ plugin, allowing to easily read data from raspberryPi's sensors.
https://www.npmjs.com/package/raspi-sensors
Apache License 2.0
26 stars 3 forks source link

Failed to open the bus: No such file or directory: code 1 #8

Closed levalencia closed 7 years ago

levalencia commented 7 years ago

Hello

I have the following code but its not working, the install of the package went well

var RaspiSensors = require('raspi-sensors');

var BMP180 = new RaspiSensors.Sensor({
  type    : "BMP180",
  address : 0x77
}, "BMP180");

BMP180.fetchInterval(function(err, data) {
    if(err) {
        console.error("An error occured!");
        console.error(err.cause);
        return;
    }

    // Log the values
    console.log(data);
}, 5); // Fetch data every 5 seconds
Vuzi commented 7 years ago

Hello, did you try reading from your i2c device manually ? For example with:

sudo i2cdetect -y 1

Also, if you're using an older rapsberry pi generation, you may have to change the i2c bus used (and also use -y 0 with i2cdetect. You'll also need to use root rights.