ble-blink

This commit is contained in:
Conner 2024-09-30 12:41:49 +02:00
parent 82f1227593
commit 5ef5efac6c

View file

@ -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();