add digitalWrite functions
This commit is contained in:
parent
5e27c5f359
commit
b284e2ebab
8 changed files with 295 additions and 19 deletions
21
examples/nightrider.rs
Normal file
21
examples/nightrider.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
use std::{thread::sleep, time::Duration};
|
||||
|
||||
use b15f::b15f::B15F;
|
||||
|
||||
fn main() {
|
||||
let mut drv = B15F::new().unwrap();
|
||||
|
||||
let mut position = 0;
|
||||
let mut direction = 1;
|
||||
|
||||
loop {
|
||||
drv.digital_write::<0>(1 << position);
|
||||
|
||||
position += direction;
|
||||
if position >= 7 || position <= 0 {
|
||||
direction *= -1;
|
||||
}
|
||||
|
||||
sleep(Duration::from_millis(50));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue