#![no_std] #![no_main] use core::time::Duration; use vex_rt::prelude::*; struct ChannelBot { chan: ReceiveChannel, } impl Robot for ChannelBot { fn new(_peripherals: Peripherals) -> Self { let (send, receive) = channel(); let mut x = 0; let mut l = Loop::new(Duration::from_secs(1)); Task::spawn(move || loop { x += 1; select! { _ = send.select(x) => {}, } l.delay(); }) .unwrap(); Self { chan: receive } } fn opcontrol(&mut self, ctx: Context) { println!("opcontrol"); let mut l = Loop::new(Duration::from_millis(750)); loop { select! { x = self.chan.select() => println!("{}", x), _ = l.select() => println!("tick"), _ = ctx.done() => break, } } } } entry!(ChannelBot);