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::thread;
|
||||
use std::time::Duration;
|
||||
use tokio::time;
|
||||
use tokio::time::{self, sleep};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[tokio::main]
|
||||
|
@ -43,13 +43,13 @@ async fn main() -> Result<(), Box<dyn Error>> {
|
|||
println!("Characteristics: {:#?}", chars);
|
||||
|
||||
let light = chars.iter().find(|c| c.uuid == characteristic).unwrap();
|
||||
|
||||
handle
|
||||
.write(light, &[0x00], WriteType::WithoutResponse)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
println!("LED");
|
||||
while true {
|
||||
handle
|
||||
.write(light, &[0x00], WriteType::WithoutResponse)
|
||||
.await
|
||||
.unwrap();
|
||||
sleep(Duration::new(2, 0)).await;
|
||||
}
|
||||
|
||||
handle.disconnect().await.unwrap();
|
||||
|
||||
|
|
Loading…
Reference in a new issue