raspi-sensors icon indicating copy to clipboard operation
raspi-sensors copied to clipboard

Option for BCM numbering

Open rdagger opened this issue 9 years ago • 3 comments

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.

rdagger avatar Apr 03 '16 22:04 rdagger

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.

Vuzi avatar Apr 04 '16 00:04 Vuzi

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] 
}

FlorianWendelborn avatar Apr 04 '16 00:04 FlorianWendelborn

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

rdagger avatar Apr 04 '16 02:04 rdagger