jperkin / node-rpio

Raspberry Pi GPIO library for node.js
860 stars 126 forks source link

RPI 1 #43

Closed bahamut657 closed 7 years ago

bahamut657 commented 7 years ago

I try your code in RaspberryPI 1. Using mapping = 'gpio' seems does not work. Reverting to mapping = 'physical' work correctly.

jperkin commented 7 years ago

Any more details? In what way does it not work? Have you double checked your pin configurations? Are there any specific pins which are not working? Thanks.

bahamut657 commented 7 years ago

It seems that in GPIO mapping mode, it does not bringup the GPIO pin specified(I also tried changing PIN number but GPIO remain on 0 Volts and LED reamin OFF) This is the code: const RPIO = require("rpio"); RPIO.init({ mapping:"gpio" }); / IF I REMOVE THIS INIT AND CHANGE THE PIN NUMBER TO 12 IT WORKS /

RPIO.open(1, RPIO.OUTPUT, RPIO.LOW); for (var i = 0; i < 5000; i++) { / On for 1 second / RPIO.write(1, RPIO.HIGH); RPIO.sleep(1);

    /* Off for half a second (500ms) */
    RPIO.write(1, RPIO.LOW);
    RPIO.msleep(500);

}

jperkin commented 7 years ago

GPIO1 is pin5 not pin12, check the mapping you have for your hardware revision. I find http://raspi.tv/wp-content/uploads/2014/07/Raspberry-Pi-GPIO-pinouts.png to be quite a useful one.