PiPHP / GPIO

A PHP library for accessing the GPIO pins on a Raspberry Pi.
MIT License
431 stars 42 forks source link

EDGE_RISING behaving like EDGE_BOTH #22

Open ephestione opened 5 years ago

ephestione commented 5 years ago

First of all, I see no activity in this repo since a while ago, and even if I'm currently using it in a project of mine, are there any reasons that I shouldn't?

Now to the question. First version of my code was using: $pin[$sensore]->setEdge(InputPinInterface::EDGE_BOTH);

but then I realized I only was actually inerested to check when the input became from LOW to HIGH, so I changed it to $pin[$sensore]->setEdge(InputPinInterface::EDGE_RISING);

What I noticed, tho, is that I kept getting the same amount of events of the first version. It's a motion sensor which is activated, and then deactivates itself after 2-3 seconds, and even if I try and select only EDGE_RISING (activation in this case) I get an event both when sensor activates (LOW->HIGH) and when it deactivates (HIGH->LOW).

Shouldn't matter much as I can prune those event I'm not interested in, I just wonder if it wouldn't use less resources if it worked as intended.