drone_state/
drone_state.rs1extern crate tello_edu;
2
3use tello_edu::{TelloOptions, Tello, Result};
4
5#[tokio::main]
6async fn main() {
7 fly().await.unwrap();
8}
9
10async fn fly() -> Result<()> {
11 let drone = Tello::new()
12 .wait_for_wifi().await?;
13
14 let mut options = TelloOptions::default();
15
16 let mut state_receiver = options.with_state();
18
19 tokio::spawn(async move {
21 loop {
22 let state = state_receiver.recv().await.unwrap();
23 println!("STATE {state:#?}");
24 }
25 });
26
27 let drone = drone.connect_with(options).await?;
29
30 drone.take_off().await?;
32 drone.turn_clockwise(360).await?;
33 drone.land().await?;
34
35 Ok(())
36}