This is my simple setup
simulate this circuit – Schematic created using CircuitLab
This is my test program, using nodejs and rpi-gpio.
var gpio = require('rpi-gpio');
gpio.on('change', function(channel, value) {
console.log('Channel ' + channel + ' value is now ' + value);
});
gpio.setup(36, gpio.DIR_IN, gpio.EDGE_BOTH);
I expect when I close the switch the voltage at point A to drop to 0 and trigger a falling edge interrupt, however all I see in my program is rising edge interrupts, i.e.:
Channel 36 value is now true
Channel 36 value is now true
Channel 36 value is now true
I had my doubts, as this is not the best library for GPIO manipulation, that there might be some kind of bug, but I physically separated GPIO16 from A (pulled out the jumper cable on the pin) and then I saw a falling edge interrupt
Channel 36 value is now true
Channel 36 value is now true
Channel 36 value is now true
Channel 36 value is now false
I also measured the voltage at point A which is about 2.7V regardless of whether the switch is open or closed.
Something that may be worth mentioning is that the distance between A and SW1 is about 4 meters. And that's also why I'm pulling up, as I can't move SW1 physically and there is already ground there, this way I'm saving 1 cable of about 4 meters.
I'm missing something which is probably really silly, but oh well..
Oh and I'm aware there are internal pull-up resistors but I'd rather use external ones.
sudo pigpiod
followed by./monitor.py 16
).true
?