rust-embedded / rust-embedded/linux-embedded-hal
Add example?
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 319
- Forks
- 60
- Avg merge
- 12h 31m
- Merged PRs (30d)
- 1
Description
Greetings.
I was kind of having a hard time getting the grasp of trying to use the digital GPIO pin. I worked it out in the end anyway, but I think it would be cool to add basic examples as simple as LED blinking, LED breathing, etc. like this:
extern crate linux_embedded_hal as hal;
use hal::sysfs_gpio::{Pin, Direction};
use std::error::Error;
use std::thread;
use std::time::Duration;
fn main() -> Result<(), Box<dyn Error>> {
let gpio = Pin::new(198);
match gpio.export() {
Ok(()) => println!("Gpio {} exported!", gpio.get_pin()),
Err(err) => println!("Gpio {} could not be exported: {}", gpio.get_pin(), err)
}
gpio.set_direction(Direction::Out)?;
gpio.set_value(1)?;
thread::sleep(Duration::from_secs(1));
gpio.set_value(0)?;
Ok(())
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Begin with the Rust GPIO snippet in this issue and inspect the repository's existing conventions for examples. Add basic digital GPIO examples such as LED blinking and breathing, then confirm that the examples build and are usable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- embedded-iot
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100