ble-blink
This commit is contained in:
parent
82f1227593
commit
5ef5efac6c
|
@ -6,7 +6,7 @@ use std::error::Error;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use tokio::time;
|
use tokio::time::{self, sleep};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
|
@ -43,13 +43,13 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
||||||
println!("Characteristics: {:#?}", chars);
|
println!("Characteristics: {:#?}", chars);
|
||||||
|
|
||||||
let light = chars.iter().find(|c| c.uuid == characteristic).unwrap();
|
let light = chars.iter().find(|c| c.uuid == characteristic).unwrap();
|
||||||
|
while true {
|
||||||
handle
|
handle
|
||||||
.write(light, &[0x00], WriteType::WithoutResponse)
|
.write(light, &[0x00], WriteType::WithoutResponse)
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
sleep(Duration::new(2, 0)).await;
|
||||||
println!("LED");
|
}
|
||||||
|
|
||||||
handle.disconnect().await.unwrap();
|
handle.disconnect().await.unwrap();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue