#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let link_context = crazyflie_lib::crazyflie_link::LinkContext::new();
let found = link_context.scan([0xE7; 5]).await?;
if let Some(uri) = found.first() {
println!("Connecting to {} ...", uri);
let cf = crazyflie_lib::Crazyflie::connect_from_uri(
&link_context,
uri,
crazyflie_lib::NoTocCache
)
.await?;
println!("Connected!");
let firmware_version = cf.platform.firmware_version().await?;
let protocol_version = cf.platform.protocol_version().await?;
println!(
"Firmware version: {} (protocol {})",
firmware_version, protocol_version
);
let device_type = cf.platform.device_type_name().await?;
println!("Device type: {}", device_type);
println!("Number of params var: {}", cf.param.names().len());
println!("Number of log var: {}", cf.log.names().len());
cf.disconnect().await;
} else {
println!("No Crazyflie found, exiting!");
}
Ok(())
}