{"id":17149900,"url":"https://github.com/drahoslove/go-nec","last_synced_at":"2025-10-04T00:34:22.588Z","repository":{"id":89124683,"uuid":"110700040","full_name":"drahoslove/go-nec","owner":"drahoslove","description":"Implementation of NEC - Infrared transmission protocol - in golang","archived":false,"fork":false,"pushed_at":"2018-10-14T22:39:41.000Z","size":5,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T12:15:50.622Z","etag":null,"topics":["nec","protocol"],"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/drahoslove.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":"2017-11-14T14:23:06.000Z","updated_at":"2022-01-20T10:21:40.000Z","dependencies_parsed_at":"2023-06-14T01:15:19.249Z","dependency_job_id":null,"html_url":"https://github.com/drahoslove/go-nec","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/drahoslove/go-nec","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drahoslove%2Fgo-nec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drahoslove%2Fgo-nec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drahoslove%2Fgo-nec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drahoslove%2Fgo-nec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drahoslove","download_url":"https://codeload.github.com/drahoslove/go-nec/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drahoslove%2Fgo-nec/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267807710,"owners_count":24147352,"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-07-30T02:00:09.044Z","response_time":70,"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":["nec","protocol"],"created_at":"2024-10-14T21:34:23.994Z","updated_at":"2025-10-04T00:34:17.552Z","avatar_url":"https://github.com/drahoslove.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-nec\nImplementation of IR transmition NEC protocol in golang\n\n\n## usage\n```go\npackage main\n\nimport (\n        \"os\"\n        \"flag\"\n        \"github.com/stianeikeland/go-rpio\"\n        \"github.com/drahoslav7/go-nec\"\n)\n\nvar (\n        addr uint = 61184 // 24 key ir remote control\n        cmd uint = 3 // ON\n)\n\nfunc init() {\n        flag.UintVar(\u0026cmd, \"c\", cmd, \"command to send (0-23)\")\n        flag.Parse()\n}\n\nfunc main() {\n        // init gpio\n        err := rpio.Open()\n        if err != nil {\n                os.Exit(1)\n        }\n        defer rpio.Close()\n\n        pin := rpio.Pin(2)\n        pin.Mode(rpio.Output)\n        pin.Write(rpio.Low)\n\n        // transmition funcion\n        toLED := func(v bool) {\n                if v {\n                        pin.Write(rpio.High)\n                } else {\n                        pin.Write(rpio.Low)\n                }\n        }\n        nec.EncodeExt(uint16(addr), uint8(cmd)).TransmitTimes(toLED, 3)\n}\n\n```\n\n\n## examples of NEC protocol\n\n#### classic:\n\n`addr = 0`\n`cmd  = 1`\n\n`data = addr + ^addr + cmd + ^cmd`\n=\u003e `00 FF 80 7F`\n```\n      9 ms      | 4.5 ms |         addr          |                 ^addr                 |          cmd            |                 ^cmd                | end\n1111111111111111 00000000 10 10 10 10 10 10 10 10 1000 1000 1000 1000 1000 1000 1000 1000 1000 10 10 10 10 10 10 10 10 1000 1000 1000 1000 1000 1000 1000 10000000...\n                           0  0  0  0  0  0  0  0   1    1    1    1    1    1    1    1    1   0  0  0  0  0  0  0  0    1    1    1    1    1    1    1\n```\n`nec.Encode(0, 1)` or `nec.NewSignal(0x00FF807F)`\n\n#### extended:\n\n`addr = 61184`\n`cmd = 3`\n\n`data = low_addr + high_addr + cmd + ^cmd`\n=\u003e `00 F7 C0 3F`\n```    \n      9 ms      | 4.5 ms |        low addr       |               high addr             |          cmd              |                 ^cmd              | end\n1111111111111111 00000000 10 10 10 10 10 10 10 10 1000 1000 1000 1000 10 1000 1000 1000 1000 1000 10 10 10 10 10 10 10 10 1000 1000 1000 1000 1000 1000 10000000...\n                           0  0  0  0  0  0  0  0   1    1    1    1   0   1    1    1    1    1   0  0  0  0  0  0  0  0   1    1    1    1    1    1\n```\n`nec.EncodeExt(61184, 3)` or `nec.NewSignal(0x00F7C03F)`\n\n#### repeat code:\n```\n      9 ms      |2.25|\n1111111111111111 0000 1000...\n```\n`nec.NewRepeatSignal()`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrahoslove%2Fgo-nec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrahoslove%2Fgo-nec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrahoslove%2Fgo-nec/lists"}