https://github.com/fhennig/pi_ir_remote
A crate to read infrared signals from a 44-button LED remote.
https://github.com/fhennig/pi_ir_remote
infrared raspberry-pi rust
Last synced: 9 months ago
JSON representation
A crate to read infrared signals from a 44-button LED remote.
- Host: GitHub
- URL: https://github.com/fhennig/pi_ir_remote
- Owner: fhennig
- License: mit
- Created: 2020-11-16T22:19:48.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-07-20T13:14:01.000Z (over 4 years ago)
- Last Synced: 2025-03-29T20:43:55.659Z (10 months ago)
- Topics: infrared, raspberry-pi, rust
- Language: Rust
- Homepage:
- Size: 265 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# IR Remote Receiver
[crates.io](https://crates.io/crates/pi_ir_remote) - [docs.rs](https://docs.rs/pi_ir_remote/0.1.0/pi_ir_remote/) - [GitHub](https://github.com/fhennig/pi_ir_remote)
This crate provides a signal decoder for the commonly found 44-button
infra red remote used commonly with LED strips. When an IR sensor is
connected to a GPIO pin, this crate can decode the IR signals into
which button was pressed.
## Usage
This will read signals on GPIO 4 and print them:
use pi_ir_remote::read_ir_remote;
use pi_ir_remote::PrintSignalHandler;
fn main() {
let handler = PrintSignalHandler::new();
read_ir_remote(4, Box::new(handler));
}
You can make your own signal handler by implementing the SignalHandler
trait:
pub trait SignalHandler {
fn handle_signal(&mut self, signal: &Signal);
}
## How it works
The IR remote sends pulse length encoded signals. Among other special
pulses, there are a short and long pulse, corresponding to 0 and 1,
allowing the transmission of binary data.
Every button is associated to a 32 bit word. This library includes
the mapping of binary codes to buttons in the Signal enum.