{"id":17209122,"url":"https://github.com/zaquestion/go-envirophat","last_synced_at":"2025-03-25T11:41:42.672Z","repository":{"id":69164925,"uuid":"156506110","full_name":"zaquestion/go-envirophat","owner":"zaquestion","description":null,"archived":false,"fork":false,"pushed_at":"2018-11-17T21:57:43.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-30T10:41:46.585Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zaquestion.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2018-11-07T07:20:43.000Z","updated_at":"2019-10-09T17:14:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"dbca39a6-f045-4fb3-b12c-b3efd973ffc7","html_url":"https://github.com/zaquestion/go-envirophat","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaquestion%2Fgo-envirophat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaquestion%2Fgo-envirophat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaquestion%2Fgo-envirophat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zaquestion%2Fgo-envirophat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zaquestion","download_url":"https://codeload.github.com/zaquestion/go-envirophat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245458041,"owners_count":20618693,"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","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":[],"created_at":"2024-10-15T02:50:50.948Z","updated_at":"2025-03-25T11:41:42.463Z","avatar_url":"https://github.com/zaquestion.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"go-envirophat\n==\n\n`go-envirophat` is a port of the python library [enviro-phat](https://github.com/pimoroni/enviro-phat) with some design liberties taken. It allows you to interact with the [Enviro pHAT](https://shop.pimoroni.com/products/enviro-phat) on the Rasberry Pi.\n\n### Leds\n```\nimport \"github.com/zaquestion/go-envirophat/leds\"\n```\n```\nleds.On()\n```\n\n### Light\n```\nimport \"github.com/zaquestion/go-envirophat/light\"\n```\n```\n\ti2c, err := light.InitI2C()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer i2c.Close()\n\n\tdata, err := light.Read()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tbuf, err := json.Marshal(data)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(string(buf))\n```\nyields\n```\n{\n  \"Red\": 161,\n  \"Green\": 108,\n  \"Blue\": 98,\n  \"RawLux\": 1183,\n  \"RawRed\": 749,\n  \"RawGreen\": 505,\n  \"RawBlue\": 456,\n  \"NormalRed\": 0.6331360946745562,\n  \"NormalGreen\": 0.4268808114961961,\n  \"NormalBlue\": 0.38546069315300086\n}\n```\n\n### Weather\n```\n\ti2c, err := weather.InitI2C()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer i2c.Close()\n\n\t// Read temperature in celsius degree\n\tt, err := weather.Temperature()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Printf(\"Temperature = %v*C\\n\", t)\n\t// Read atmospheric pressure in pascal\n\tp, err := weather.Pressure()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Printf(\"Pressure = %v Pa\\n\", p)\n\t// Read atmospheric altitude in meters above sea level, if we assume\n\t// that pressure at see level is equal to 101325 Pa.\n\ta, err := weather.Altitude()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tlog.Printf(\"Altitude = %v m\\n\", a)\n```\n\n### TODO:\n - Remaining sensors\n - Support raspberry pi 1?\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzaquestion%2Fgo-envirophat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzaquestion%2Fgo-envirophat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzaquestion%2Fgo-envirophat/lists"}