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

Option for BCM numbering #3

Open rdagger opened 8 years ago

rdagger commented 8 years ago

Great job. This is the first package I’ve found that works flawlessly with the DHT-22. Would it be possible to add an option to use BCM numbering instead of board for the GPIO pins? For example, some packages have a set mode option to switch between BCM and board. Or some packages allow you to specify a string such as “GPIO21” instead of a number for BCM.

Vuzi commented 8 years ago

Thanks !

I'm using wiringPi for GPIO pins, and I think they allow to use both BCM and board for pin numbering (http://wiringpi.com/pins/). I'll look into it, and maybe add some option to the plugin initialization to set the numbering mode to use.

FlorianWendelborn commented 8 years ago

As a workaround, you should be able to just warp a "matcher" around this like that:

var matcher = {
  '1': 5,
  '4': 8
};

var DHT22 = new RaspiSensors.Sensor({
    type    : "DHT22",
    pin: matcher[4] 
}
rdagger commented 8 years ago

Thanks, the wiring gets confusing when you are working with multiple packages and they have different numbering.