{"id":19155581,"url":"https://github.com/raspberrypi-go-drivers/passivebuzzer","last_synced_at":"2026-05-04T11:38:43.688Z","repository":{"id":57558603,"uuid":"322721242","full_name":"raspberrypi-go-drivers/passivebuzzer","owner":"raspberrypi-go-drivers","description":"Allows to control a passive buzzer connected to a GPIO pin","archived":false,"fork":false,"pushed_at":"2020-12-18T22:59:02.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-12T13:01:51.177Z","etag":null,"topics":["driver","go","golang","raspberry-pi","raspberrypi-drivers","robotics"],"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/raspberrypi-go-drivers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-18T22:48:12.000Z","updated_at":"2020-12-19T10:36:26.000Z","dependencies_parsed_at":"2022-09-15T19:30:58.089Z","dependency_job_id":null,"html_url":"https://github.com/raspberrypi-go-drivers/passivebuzzer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/raspberrypi-go-drivers/passivebuzzer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raspberrypi-go-drivers%2Fpassivebuzzer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raspberrypi-go-drivers%2Fpassivebuzzer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raspberrypi-go-drivers%2Fpassivebuzzer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raspberrypi-go-drivers%2Fpassivebuzzer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raspberrypi-go-drivers","download_url":"https://codeload.github.com/raspberrypi-go-drivers/passivebuzzer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raspberrypi-go-drivers%2Fpassivebuzzer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32606405,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"ssl_error","status_checked_at":"2026-05-04T10:08:02.005Z","response_time":58,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["driver","go","golang","raspberry-pi","raspberrypi-drivers","robotics"],"created_at":"2024-11-09T08:31:15.812Z","updated_at":"2026-05-04T11:38:43.660Z","avatar_url":"https://github.com/raspberrypi-go-drivers.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Passive Buzzer\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/raspberrypi-go-drivers/passivebuzzer.svg)](https://pkg.go.dev/github.com/raspberrypi-go-drivers/passivebuzzer)\n![golangci-lint](https://github.com/raspberrypi-go-drivers/passivebuzzer/workflows/golangci-lint/badge.svg)\n[![Go Report Card](https://goreportcard.com/badge/github.com/raspberrypi-go-drivers/passivebuzzer)](https://goreportcard.com/report/github.com/raspberrypi-go-drivers/passivebuzzer)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nPackage passivebuzzer is a driver allowing to control a passive buzzer from a GPIO pin\n\n## Documentation\n\nFor full documentation, please visit [![Go Reference](https://pkg.go.dev/badge/github.com/raspberrypi-go-drivers/passivebuzzer.svg)](https://pkg.go.dev/github.com/raspberrypi-go-drivers/passivebuzzer)\n\n## Quick start\n\n```go\nimport (\n\t\"math\"\n\t\"os\"\n\t\"time\"\n\n\t\"github.com/raspberrypi-go-drivers/passivebuzzer\"\n\t\"github.com/stianeikeland/go-rpio/v4\"\n)\n\nconst (\n\tc4  float64 = 261.63 // Hz\n\td4  float64 = 293.66 // Hz\n\te4  float64 = 329.63 // Hz\n\tf4  float64 = 349.23 // Hz\n\tfd4 float64 = 369.99 // Hz\n\tg4  float64 = 392.00 // Hz\n\ta4  float64 = 440.00 // Hz\n\tb4  float64 = 493.88 // Hz\n\tc5  float64 = 523.25 // Hz\n\td5  float64 = 587.33 // Hz\n\te5  float64 = 659.25 // Hz\n\tf5  float64 = 698.46 // Hz\n\tfd5 float64 = 739.99 // Hz\n\tg5  float64 = 783.99 // Hz\n\t// https://pages.mtu.edu/~suits/notefreqs.html\n)\n\ntype note struct {\n\tnote     float64\n\tduration float64\n}\n\nfunc main() {\n\terr := rpio.Open()\n\tif err != nil {\n\t\tos.Exit(1)\n\t}\n\tdefer rpio.Close()\n\tbuzzer := passivebuzzer.NewPassiveBuzzer(18)\n\tmelody := []note{\n\t\t{e4, 1}, {g4, 1}, {b4, 1}, {e5, 1}, {b4, 1},\n\t\t{g4, 1}, {e4, 1}, {g4, 1}, {b4, 1}, {g5, 1},\n\t\t{g4, 0.5}, {e5, 0.5}, {b4, 0.5}, {g4, 0.5},\n\t\t{fd5, 1}, {d4, 0.5}, {g5, 0.5}, {d5, 0.5},\n\t\t{g4, 0.5}, {g5, 1}, {d5, 0.5}, {g4, 0.5},\n\t\t{g4, 0.5}, {fd4, 0.5}, {e4, 2},\n\t}\n\tfor _, n := range melody {\n\t\tbuzzer.Tone(n.note)\n\t\tmultiplier := int(math.RoundToEven(400.0 * n.duration))\n\t\ttime.Sleep(time.Duration(multiplier) * time.Millisecond)\n\t\tbuzzer.StopTone()\n\t\ttime.Sleep(33 * time.Millisecond)\n\t}\n}\n```\n\n## Raspberry Pi compatibility\n\nThis driver has has only been tested on an Raspberry Pi Zero WH using integrated bluetooth but may work well on other Raspberry Pi having integrated Bluetooth\n\n## License\n\nMIT License\n\n---\n\nSpecial thanks to @stianeikeland\n\nThis driver is based on his work in [stianeikeland/go-rpio](https://github.com/stianeikeland/go-rpio/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraspberrypi-go-drivers%2Fpassivebuzzer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraspberrypi-go-drivers%2Fpassivebuzzer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraspberrypi-go-drivers%2Fpassivebuzzer/lists"}