e_drone_rpi

Crates.ioe_drone_rpi
lib.rse_drone_rpi
version22.1.1
sourcesrc
created_at2021-02-22 06:05:47.144757
updated_at2022-01-05 03:30:47.218319
descriptionRust library for BYROBOT Drones.
homepagehttps://github.com/byrobot-rust/e_drone_rpi
repositoryhttps://github.com/byrobot-rust/e_drone_rpi
max_upload_size
id358812
size39,325
Sanghyo Lee (realwolf)

documentation

https://docs.rs/e_drone_rpi

README

e_drone_rpi

Rust library for BYROBOT drones.



Example

Cargo.toml

[dependencies]
e_drone_rpi="21.*"
e_drone="21.*"


main.rs

extern crate e_drone_rpi;

use e_drone::system::{*};
use e_drone::protocol::{*};
use e_drone_rpi::{*};


fn main() {
    let mut drone: Drone = Drone::new();      // Raspberry PI UART
    //let mut drone: Drone = Drone::new_path("/dev/ttyACM0"); // Raspberry PI USB

    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);
        },
        _ => {},
    }
}


Examples in library


Source code

https://github.com/byrobot-rust/e_drone_rpi/tree/master/examples



Show in github1s.com




Clone Library

git clone https://github.com/byrobot-rust/e_drone_rpi/


Run

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
Commit count: 21

cargo fmt