blob: 5dce698525c052d2aca887d72a8419a9db7a760b [file] [log] [blame]
Amit Aryeh Levyf0d66d02017-08-15 11:47:46 -07001#![no_std]
2
Alistair Francise5f74c32020-09-11 15:21:14 -07003use libtock::println;
torfmaster3d605242019-12-16 22:36:39 +01004use libtock::result::TockResult;
Woytenb1226202020-01-13 22:47:48 +01005use libtock::sensors::Sensor;
torfmasterc84685a2019-02-08 19:23:22 +01006use libtock::timer::Duration;
Amit Aryeh Levyf0d66d02017-08-15 11:47:46 -07007
Johnathan Van Why074fa7d2020-10-14 17:06:50 -07008libtock_core::stack_size! {0x800}
9
torfmasterb06f6372019-12-17 09:20:48 +010010#[libtock::main]
torfmaster3d605242019-12-16 22:36:39 +010011async fn main() -> TockResult<()> {
Woytenb1226202020-01-13 22:47:48 +010012 let mut drivers = libtock::retrieve_drivers()?;
Woyten8d517b02020-01-13 20:58:20 +010013
Woytenb1226202020-01-13 22:47:48 +010014 let mut timer_driver = drivers.timer.create_timer_driver();
Woyten8d517b02020-01-13 20:58:20 +010015 let timer_driver = timer_driver.activate()?;
Alistair Francise5f74c32020-09-11 15:21:14 -070016 drivers.console.create_console();
torfmasterf7ac7c92019-11-17 00:33:28 +010017
torfmasterd5db0302019-11-14 19:06:10 +010018 loop {
Alistair Francise5f74c32020-09-11 15:21:14 -070019 println!("Humidity: {}\n", drivers.humidity_sensor.read()?);
20 println!("Temperature: {}\n", drivers.temperature_sensor.read()?);
21 println!("Light: {}\n", drivers.ambient_light_sensor.read()?);
22 println!("Accel: {}\n", drivers.ninedof.read_acceleration()?);
torfmaster6ecb72f2019-12-18 12:17:34 +010023 timer_driver.sleep(Duration::from_ms(500)).await?;
torfmasterd5db0302019-11-14 19:06:10 +010024 }
Amit Aryeh Levyf0d66d02017-08-15 11:47:46 -070025}