2 ms·
I agree with a sibling comment point that Arduino's main strength is that it simplifies the installation of tooling, not that the code is particularly easy. But
by nextaccountic 4y ago
I agree with a sibling comment point that Arduino's main strength is that it simplifies the installation of tooling, not that the code is particularly easy. But, on the code side, I think that embedded-hal is excellent
https://docs.rs/embedded-hal/latest/embedded_hal/ https://docs.rs/embedded-hal/latest/embedded_hal/
Here are the supported boards
https://github.com/rust-embedded/awesome-embedded-rust#hal-implementation-crates https://github.com/rust-embedded/awesome-embedded-rust#hal-i...
There's a book on rust on esp https://esp-rs.github.io/book/ https://esp-rs.github.io/book/
Here's how to blink a led using esp-idf-hal, targetting espressif
https://github.com/esp-rs/esp-idf-hal/blob/master/examples/blinky.rs https://github.com/esp-rs/esp-idf-hal/blob/master/examples/b...
/! Blinks an LED
//!
//! This assumes that a LED is connected to GPIO4.
//! Depending on your target and the board you are using you should change the pin.
//! If your board doesn't have on-board LEDs don't forget to add an appropriate resistor.
//!
use esp_idf_hal::delay::FreeRtos;
use esp_idf_hal::gpio::*;
use esp_idf_hal::peripherals::Peripherals;
fn main() -> anyhow::Result<()> {
esp_idf_sys::link_patches();
let peripherals = Peripherals::take().unwrap();
let mut led = PinDriver::output(peripherals.pins.gpio4)?;
loop {
led.set_high()?;
// we are sleeping here to make sure the watchdog isn't triggered
FreeRtos::delay_ms(1000);
led.set_low()?;
FreeRtos::delay_ms(1000);
}
}