{"id":15132848,"url":"https://github.com/gnyblast/go-gpiocdev-eventhandlers","last_synced_at":"2026-02-18T18:01:44.789Z","repository":{"id":251358020,"uuid":"837101728","full_name":"Gnyblast/go-gpiocdev-eventhandlers","owner":"Gnyblast","description":"Helper library to provide event handlers to gpioc-dev library.","archived":false,"fork":false,"pushed_at":"2024-08-04T12:52:39.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T20:35:53.802Z","etag":null,"topics":["data-collection","go","go-gpiocdev","golang","gpio","gpio-library","gpio-pins","library","raspberry-pi","sensor","sensors"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Gnyblast.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-02T08:06:44.000Z","updated_at":"2024-08-04T12:52:43.000Z","dependencies_parsed_at":"2024-08-04T14:57:08.100Z","dependency_job_id":"75975527-26c5-4398-96fe-1cced37df8c3","html_url":"https://github.com/Gnyblast/go-gpiocdev-eventhandlers","commit_stats":null,"previous_names":["gnyblast/go-gpiocdev-eventhandlers"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Gnyblast/go-gpiocdev-eventhandlers","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gnyblast%2Fgo-gpiocdev-eventhandlers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gnyblast%2Fgo-gpiocdev-eventhandlers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gnyblast%2Fgo-gpiocdev-eventhandlers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gnyblast%2Fgo-gpiocdev-eventhandlers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Gnyblast","download_url":"https://codeload.github.com/Gnyblast/go-gpiocdev-eventhandlers/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Gnyblast%2Fgo-gpiocdev-eventhandlers/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279006098,"owners_count":26084026,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-collection","go","go-gpiocdev","golang","gpio","gpio-library","gpio-pins","library","raspberry-pi","sensor","sensors"],"created_at":"2024-09-26T04:40:44.423Z","updated_at":"2025-10-11T03:19:22.243Z","avatar_url":"https://github.com/Gnyblast.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gpiocdev-eventhandlers\n\nThis repository aims to provide handlers for the [go-gpiocdev](https://github.com/warthog618/go-gpiocdev) Library's `gpiocdev.WithEventHandler` line option.\n\nIt's still under development with two sensor added to the library without tests are performed.\n\n## Usage\n\n- Each handler is a stuct that implements `IEventHandlers` generic interface.\n- `Measure()` method is used as the main handler that does the logic/calculation/measurement for the sensor data. This should be passed to `WithEeventHandler()` method.\n- `Subscribe()` is for listening measurement if immediate responses are needed when a measurement is done. It's a channel type.\n- `CloseChannels()` is the method that closes the above channel. Best to be called when usage is no more required.\n- `GetMeasurement()` is the method that return the latest measurement.\n\nA simple example might look like the following:\n\n```go\nlfs :=factory.InitializeEventHandlerFor(sensors.FLOW_SENSOR, \"gpiochip0\", \"GPIO4\", 0.002222222)\ndefer lfs.CloseChannels()\n\ngpiocdev.RequestLine(\"gpiochip0\", pin, gpiocdev.WithPullUp, gpiocdev.WithBothEdges, gpiocdev.WithEventHandler(lfs.Measure))\n\nfor {\n    fmt.Printf(\"%f Liters Flowed\",\u003c-lfs.Subscribe())\n}\n```\n\nPlease refer to the [Examples](#examples) section to see more details examples for each sensor.\n\n## Examples\n\n|Sensor|ID(sensors.go)|Image|Example|\n|------|--------------|-----|-------|\n|Water Flow Sensor|0|![WaterFlowSensor](/images/water_flow_sensor.jpg)|[example](/examples/flow_sensor/main.go)|\n|Photocell Sensor|1|![Photocell](/images/photocell.jpg)|[example](/examples/photocell_sensor/main.go)|","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgnyblast%2Fgo-gpiocdev-eventhandlers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgnyblast%2Fgo-gpiocdev-eventhandlers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgnyblast%2Fgo-gpiocdev-eventhandlers/lists"}