Mode:
Duration:
1
Coding works best on desktop or with an external keyboard.
Coding works best on desktop or with an external keyboard.
Read a potentiometer value from an ADC pin and print via serial.
#![no_std]
#![no_main]
use panic_halt as _;
use cortex_m_rt::entry;
use stm32f4xx_hal::{adc::Adc, prelude::*, serial::Serial, stm32};
#[entry]
fn main() -> ! {
let dp = stm32::Peripherals::take().unwrap();
let mut adc = Adc::adc1(dp.ADC1, true);
let mut serial = Serial::usart2(dp.USART2, ...);
loop {
let value: u16 = adc.read(&mut dp.GPIOA.pa0).unwrap();
writeln!(serial, "ADC value: {}", value).unwrap();
}
}Embedded Rust refers to using the Rust programming language to develop software for embedded systems, microcontrollers, and resource-constrained devices. It focuses on safety, performance, and concurrency without relying on runtime environments or garbage collection.
Origin & Creator
Rust was created by Mozilla in 2010 to offer a safe, fast, and concurrent systems programming language. Embedded Rust emerged through the community’s adaptation of Rust for microcontroller and bare-metal programming.
Industrial Note
Embedded Rust is increasingly adopted in safety-critical industries such as automotive, aerospace, and industrial IoT for reliable, memory-safe firmware development.