https://github.com/joeferner/pigpio-ir
pigpio IR Receiver/Transmitter
https://github.com/joeferner/pigpio-ir
pigpio raspberry-pi raspberrypi
Last synced: 5 months ago
JSON representation
pigpio IR Receiver/Transmitter
- Host: GitHub
- URL: https://github.com/joeferner/pigpio-ir
- Owner: joeferner
- Created: 2020-09-08T13:47:21.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-10-21T18:57:22.000Z (over 5 years ago)
- Last Synced: 2025-02-13T20:24:29.127Z (over 1 year ago)
- Topics: pigpio, raspberry-pi, raspberrypi
- Language: TypeScript
- Homepage:
- Size: 204 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Wrapper around [pigpio](https://github.com/fivdi/pigpio) to provide transmitting and receiving of IR signals using
standard remote controls.
## Install
`npm install pigpio-ir`
## Usage
### Command Line
The following are some useful built in commands to get you started. You will probably need to run them using `sudo`
#### irrecord
`irrecord` is used to populate a configuration file with know IR remotes and buttons.
Example:
```
irrecord --pin=27 --file ~/my-remotes.json --remote=samsung --button=POWER
```
#### irplay
`irplay` is used to play existing buttons back from a file generated from `irrecord`
Example:
```
irplay --pin=17 --file ~/my-remotes.json --remote=samsung --button=POWER
```
#### irlisten
`irlisten` is used to continuously listen for IR signals and print when one is recieved
Example:
```
irlisten --pin=27 --file ~/my-remotes.json
```
### From Node Application
Example program to start listening and print any buttons received
```
import { ButtonEventData, PigpioIr } from 'pigpio-ir';
const pigpioIr = await PigpioIr.fromFile(args.file, {
inputPin: 17,
tolerance: 0.1,
});
pigpioIr.on('button', (data: ButtonEventData) => {
console.log(`button press ${data.remoteName} - ${data.buttonName}`);
});
pigpioIr.start();
```