Crates.io | JL_IA7 |
lib.rs | JL_IA7 |
version | 0.1.0 |
source | src |
created_at | 2020-09-30 23:25:46.449398 |
updated_at | 2020-09-30 23:25:46.449398 |
description | Getting datas from GPS |
homepage | |
repository | |
max_upload_size | |
id | 294841 |
size | 10,266,242 |
How to use crate_IA7_GPS
connect your GPS to the raspberry berry via Tx and Rx pin.
create a structure like that :
let mut data= GpsData { Uart_ : Uart::new(9600, Parity::None, 8, 1)?, id : "0".to_string(), time : "0".to_string(), lat : "0".to_string(), long : "0".to_string(), nbSat : "0".to_string(), hdop : "0".to_string(), alti : "0".to_string(), };
Initialisation with data.init()
Getting data with data.getdata()
All the useful data will be set in the structure () id time latitude longitude Number of sat altitude
example :
fn main() -> Result<(), Box
let mut data= GpsData {
Uart_ : Uart::new(9600, Parity::None, 8, 1)?,
id : "0".to_string(),
time : "0".to_string(),
lat : "0".to_string(),
long : "0".to_string(),
nbSat : "0".to_string(),
hdop : "0".to_string(),
alti : "0".to_string(),
};
data.init();
// println!("Start");
loop {
data.getData();
println!("lat : {} N", data.lat);
println!("long : {} W", data.long);
thread::sleep(Duration::from_millis(1000));
}
Ok(())
}