simple library to control 433 Mhz target devices using a Raspberry Pi and a 433 Mhz transmitter module using the excellent rppal crate
A fully working example with a command line interface can be found here:
https://github.com/elkasztano/sparkypi
[dependencies]
rppal = "0.14.1"
libsparkypi = "0.1.0"
``` use libsparkypi::Transmission; use rppal::gpio::Gpio; use std::error::Error;
fn main() -> Result<(), Box
let mut output_pin = gpio.get(17)?.into_output();
let mut my_transmission = Transmission::new();
my_transmission.sequence.push_str("s000000010101000101011001");
my_transmission.pulse_length = 170;
my_transmission.repeats = 5;
println!("{:?}", &my_transmission);
my_transmission.send_to(&mut output_pin);
Ok(())
} ``` The above example will transmit the binary sequence '000000010101000101011001' with a leading sync bit and a pulse length of 170 microseconds 5 times. The data pin of the transmitter module is connected to GPIO pin 17 on the Raspberry Pi.