Skip to content

Help Needed with LEDC Breathing Light on ESP32-C3 #2620

Closed Answered by bjoernQ
khsdfyd asked this question in Q&A
Discussion options

You must be logged in to vote

This is your code changed to work (note I also used a different GPIO (3 instead of 12 in your code)

#![no_std]
#![no_main]

use esp_backtrace as _;
use esp_hal::{
    gpio::Io, ledc::{self, timer, LSGlobalClkSource, LowSpeed}, prelude::*
};

#[entry]
fn main() -> ! {
    #[allow(unused)]
    let peripherals = esp_hal::init(esp_hal::Config::default());

    esp_println::logger::init_logger_from_env();

    let io = Io::new(peripherals.GPIO, peripherals.IO_MUX);

    let mut ledc_1 = ledc::Ledc::new(peripherals.LEDC);
    ledc_1.set_global_slow_clock(LSGlobalClkSource::APBClk);
 
    // you shouldn't try to construct a new timer via `new` but get it from the driver   
    let mut ledc_timer…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@khsdfyd
Comment options

Answer selected by khsdfyd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants