stianeikeland / go-rpio

:electric_plug: Raspberry Pi GPIO library for go-lang
MIT License
2.2k stars 221 forks source link

Question, not issue or complaint #45

Open chornbe opened 5 years ago

chornbe commented 5 years ago

Hi. Is there an event model for this, or do we loop / state machine it for reading multiple inputs?

Thanks!

drahoslove commented 5 years ago

Hi. There is "partial" event support.

You can use DetectEdge to register for the falling/rising edge event, but you still have to manually check if the event occurred by calling EdgeDetected

See the doc and the example for more info.

And also this issue https://github.com/stianeikeland/go-rpio/issues/21 with some reasoning why it's slightly better than regular polling.