// Refactor the LED fading code to control the position of a servo motor connected to a pin using PWM.
// Implement functions to move the servo motor smoothly from its minimum position to its maximum
// position and back again over a specified duration. Assume access to PWM functions in your library.
// You can rotate the servo motor shaft from 0𝑜 to 180𝑜 by varying the PWM pulse width from 1 ms to
// 2 ms for a 50 Hz (20 ms period) signal. This corresponds to a 5-10% duty cycle on a 50 Hz waveform.
#![no_std]
#![no_main]
use esp_backtrace as _;
use esp_println::println;
use esp_hal::{clock::ClockControl, peripherals::Peripherals, prelude::*, Delay};
#[entry]
fn main() -> ! {
let peripherals = Peripherals::take();
let system = peripherals.SYSTEM.split();
let clocks = ClockControl::boot_defaults(system.clock_control).freeze();
let mut delay = Delay::new(&clocks);
println!("Hello world!");
loop {
println!("Loop...");
delay.delay_ms(500u32);
}
}