pub fn query(query: Query) -> Result<String, Error>Expand description
Extracts the item associated with a given query by calling the Arduino CLI - or more
specifically arduino-cli board list.
ยงErrors
CommandFailure, if thearduino-clicommand fails or produces non-UTF-8 output.NoDevice, if no Arduino is connected to the computer during the call.MultipleDevices, if more than one Arduino is connected to the computer during the call.UnexpectedSyntax, if the call to the Arduino CLI produced an output in a different format than expected.
Examples found in repository?
examples/cli.rs (line 7)
6fn main() {
7 let fqbn = cli::query(cli::Query::Fqbn).unwrap();
8 println!("FQBN: {}", fqbn);
9
10 let port = cli::query(cli::Query::Port).unwrap();
11 println!("Port: {}", port);
12
13 let sketch = Path::new("sketch-path");
14
15 cli::compile(sketch).unwrap();
16 cli::upload(sketch).unwrap();
17}