1
Fork 0

send dummy command

This commit is contained in:
Andy Killorin 2025-07-12 15:47:31 -05:00
parent d900308c5d
commit 8e91a0d950
Signed by: ank
GPG key ID: 80BA307A6BD7A7E4
3 changed files with 27 additions and 2 deletions

View file

@ -1,7 +1,8 @@
#![no_std]
use serde::Serialize;
use serde::Deserialize;
#[derive(Deserialize, Default)]
#[derive(Serialize, Deserialize, Default)]
pub struct Command {
pub left: f32,
pub right: f32,

View file

@ -4,3 +4,7 @@ version = "0.1.0"
edition = "2024"
[dependencies]
serialport = "4.7.2"
postcard = "1.1.2"
common = { path = "../common" }
heapless = "0.7.17"

View file

@ -1,3 +1,23 @@
use std::{thread::sleep, time::Duration};
use common::Command;
use postcard::to_vec_cobs;
use heapless::Vec;
fn main() {
println!("Hello, world!");
let mut port = serialport::new("/dev/ttyACM0", 1152000)
.open().expect("port missing");
println!("port open");
let command = Command { left: 0.0, right: 0.7 };
let encoded: Vec<u8, 20> = to_vec_cobs(&command).unwrap();
loop {
port.write(&encoded).expect("port write fail");
println!("sending");
sleep(Duration::from_millis(200));
}
}