Crates.io | e_drone_sp |
lib.rs | e_drone_sp |
version | 22.4.1 |
source | src |
created_at | 2021-03-16 00:29:58.372438 |
updated_at | 2022-04-21 03:11:55.009471 |
description | Rust library for BYROBOT Drones. |
homepage | https://github.com/byrobot-rust/e_drone_sp |
repository | https://github.com/byrobot-rust/e_drone_sp |
max_upload_size | |
id | 369467 |
size | 47,419 |
Rust library for BYROBOT drones.
Tested
Support
If you see an error when you build your project,
error: failed to run custom build command for `libudev-sys v0.1.4`
You need to install 'libudev-dev'.
sudo apt-get install libudev-dev
[dependencies]
e_drone_sp="21.*"
e_drone="21.*"
extern crate e_drone_sp;
use e_drone::system::{*};
use e_drone::protocol::{*};
use e_drone_sp::{*};
fn main() {
let mut drone: Drone = Drone::new("COM75"); // Windows 10
//let mut drone: Drone = Drone::new("/dev/ttyACM0"); // linux, Raspberry PI USB
//let mut drone: Drone = Drone::new("/dev/serial0"); // Raspberry PI UART
if drone.is_connected() == false {
return;
}
drone.request(DeviceType::Controller, DataType::Information);
loop {
handler(&drone.check());
if drone.get_time_passed_from_last_transfer() > 1200 {
break;
}
}
}
fn handler(data: &Data) {
match data {
Data::Information(information) => {
println!("{:?}", information);
},
_ => {},
}
}
https://github.com/byrobot-rust/e_drone_sp/tree/master/examples
git clone https://github.com/byrobot-rust/e_drone_sp/
cargo run --example flight
cargo run --example button
cargo run --example buzzer
cargo run --example display
cargo run --example joystick
cargo run --example light
cargo run --example request
cargo run --example vibrator