Email or username:

Password:

Forgot your password?
7 posts total
Astra Kernel :verified:

🧛 Turn on LED(or Lamp) in low Light with Pico

- Using Rust's Embassy Framework

- Raspberry Pi Pico 2 and LDR(Light Dependent Resistor)

- Read ADC Values and Trigger LED Based on Light Intensity

#rustlang #embedded

bind_interrupts!(struct Irqs {
    ADC_IRQ_FIFO => InterruptHandler;
});

#[embassy_executor::main]
async fn main(_spawner: Spawner) {
    let p = embassy_rp::init(Default::default());
    let mut adc = Adc::new(p.ADC, Irqs, Config::default());

    let mut p26 = Channel::new_pin(p.PIN_26, Pull::None);
    let mut led = Output::new(p.PIN_15, Level::Low);

    loop {
        let level = adc.read(&mut p26).await.unwrap();
        if level > 3800 {
            led.set_high();
        } else {
            led.set_low();
        }
        Timer::after_secs(1).await;
    }
}
Etam

@AstraKernel
#Linux admin goes trough a town late a at night, talks trough a phone:

- If he's not responding, then kill him.

Local thugs:

- Whoa, respect man.

Astra Kernel :verified:

summoning circle, hope this works

🕯
🕯 🕯
🕯 🕯

🕯 friends 🕯

🕯 🕯
🕯 🕯
🕯

Go Up