{"id":17053115,"url":"https://github.com/bschwind/ir-slinger","last_synced_at":"2025-04-12T15:30:49.802Z","repository":{"id":140637738,"uuid":"52290611","full_name":"bschwind/ir-slinger","owner":"bschwind","description":"A small C library for sending infrared packets on the Raspberry Pi","archived":false,"fork":false,"pushed_at":"2019-11-13T19:33:42.000Z","size":20,"stargazers_count":99,"open_issues_count":3,"forks_count":30,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-10-31T13:50:51.398Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bschwind.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":"2016-02-22T17:16:08.000Z","updated_at":"2024-03-04T05:02:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"daa1f710-e2fe-476e-902d-b36961f78af1","html_url":"https://github.com/bschwind/ir-slinger","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/bschwind%2Fir-slinger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bschwind%2Fir-slinger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bschwind%2Fir-slinger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bschwind%2Fir-slinger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bschwind","download_url":"https://codeload.github.com/bschwind/ir-slinger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223527835,"owners_count":17160090,"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-14T10:11:22.545Z","updated_at":"2024-11-07T14:01:27.694Z","avatar_url":"https://github.com/bschwind.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"IR Slinger\n==========\n\n[![Build Status](https://travis-ci.org/bschwind/ir-slinger.svg?branch=travis)](https://travis-ci.org/bschwind/ir-slinger)\n\nSmall C library for sending infrared packets on the Raspberry Pi\nThis is a header-only library. Use it by including \"irslinger.h\" and\nlinking to libmath, pigpio, and pthread (`-lm -lpigpio -pthread`)\n\nDependencies\n------------\n\n* [libpigpio](https://github.com/joan2937/pigpio)\n  * git clone https://github.com/joan2937/pigpio.git\n  * cd pigpio\n  * make\n  * sudo make install\n\nBuild\n-----\n\n    gcc test.c -lm -lpigpio -pthread -lrt\n\nOr\n\n    clang test.c -lm -lpigpio -pthread -lrt\n\nThe `-lrt` technically isn't necessary for most versions of gcc and clang,\nbut I needed it to get Travis CI's compilers working.\n\nUsage\n-----\n\nNEC-like protocols:\n\n```c\n#include \u003cstdio.h\u003e\n#include \"irslinger.h\"\n\nint main(int argc, char *argv[])\n{\n  uint32_t outPin = 23;            // The Broadcom pin number the signal will be sent on\n  int frequency = 38000;           // The frequency of the IR signal in Hz\n  double dutyCycle = 0.5;          // The duty cycle of the IR signal. 0.5 means for every cycle,\n                                   // the LED will turn on for half the cycle time, and off the other half\n  int leadingPulseDuration = 9000; // The duration of the beginning pulse in microseconds\n  int leadingGapDuration = 4500;   // The duration of the gap in microseconds after the leading pulse\n  int onePulse = 562;              // The duration of a pulse in microseconds when sending a logical 1\n  int zeroPulse = 562;             // The duration of a pulse in microseconds when sending a logical 0\n  int oneGap = 1688;               // The duration of the gap in microseconds when sending a logical 1\n  int zeroGap = 562;               // The duration of the gap in microseconds when sending a logical 0\n  int sendTrailingPulse = 1;       // 1 = Send a trailing pulse with duration equal to \"onePulse\"\n                                   // 0 = Don't send a trailing pulse\n\n  int result = irSling(\n    outPin,\n    frequency,\n    dutyCycle,\n    leadingPulseDuration,\n    leadingGapDuration,\n    onePulse,\n    zeroPulse,\n    oneGap,\n    zeroGap,\n    sendTrailingPulse,\n    \"01000001101101100101100010100111\");\n  \n  return result;\n}\n```\n\nRC-5-like protocols:\n\n```c\n#include \u003cstdio.h\u003e\n#include \"irslinger.h\"\n\nint main(int argc, char *argv[])\n{\n\tuint32_t outPin = 23;           // The GPIO pin number the signal will be sent on\n\tint frequency = 36000;          // The frequency of the IR signal in Hz\n\tdouble dutyCycle = 0.33;        // The duty cycle of the IR signal\n\tint pulseDuration = 889;        // The duration of the the pulses in microseconds\n\n\n\tint result = irSlingRC5(\n\t\toutPin, \n\t\tfrequency, \n\t\tdutyCycle, \n\t\tpulseDuration, \n\t\t\"11010101001100\");\n\n\treturn result;\n}\n```\n\nRaw Codes:\n\n```c\n#include \u003cstdio.h\u003e\n#include \"irslinger.h\"\n\nint main(int argc, char *argv[])\n{\n\tuint32_t outPin = 4;            // The Broadcom pin number the signal will be sent on\n\tint frequency = 38000;          // The frequency of the IR signal in Hz\n\tdouble dutyCycle = 0.5;         // The duty cycle of the IR signal. 0.5 means for every cycle,\n\t                                // the LED will turn on for half the cycle time, and off the other half\n\n\tint codes[] = {\n\t\t9000, 4500, 600, 600, 600, 1688, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,\n\t\t600, 1688, 600, 1688, 600, 600, 600, 1688, 600, 1688, 600, 600, 600, 1688, 600, 1688,\n\t\t600, 600, 600, 600, 600, 1688, 600, 600, 600, 1688, 600, 1688, 600, 600, 600, 600,\n\t\t600, 600, 600, 1688, 600, 600, 600, 1688, 600, 600, 600, 600, 600, 1688, 600, 1688,\n\t\t600, 1688, 600};\n\n\tint result = irSlingRaw(\n\t\toutPin,\n\t\tfrequency,\n\t\tdutyCycle,\n\t\tcodes,\n\t\tsizeof(codes) / sizeof(int));\n\t\n\treturn result;\n}\n```\n\nGPIO Pin info from the pigpio repo:\n-----------------------------------\n\nALL gpios are identified by their Broadcom number.  See elinux.org\n\nThere are 54 gpios in total, arranged in two banks.\n\nBank 1 contains gpios 0-31.  Bank 2 contains gpios 32-54.\n\nA user should only manipulate gpios in bank 1.\n\nThere are at least three types of board.\n\nType 1\n\n    26 pin header (P1).\n\n    Hardware revision numbers of 2 and 3.\n\n    User gpios 0-1, 4, 7-11, 14-15, 17-18, 21-25.\n\nType 2\n\n    26 pin header (P1) and an additional 8 pin header (P5).\n\n    Hardware revision numbers of 4, 5, 6, and 15.\n\n    User gpios 2-4, 7-11, 14-15, 17-18, 22-25, 27-31.\n\nType 3\n\n    40 pin expansion header (J8).\n\n    Hardware revision numbers of 16 or greater.\n\n    User gpios 2-27 (0 and 1 are reserved).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbschwind%2Fir-slinger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbschwind%2Fir-slinger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbschwind%2Fir-slinger/lists"}