servo works
This commit is contained in:
parent
82f93c1dd3
commit
bcf4231c84
1 changed files with 17 additions and 1 deletions
18
src/main.rs
18
src/main.rs
|
|
@ -73,7 +73,23 @@ async fn main(spawner: Spawner) {
|
||||||
let channel = p.PA0.into();
|
let channel = p.PA0.into();
|
||||||
spawner.spawn(unwrap!(read_adc1_pa0(a, channel)));
|
spawner.spawn(unwrap!(read_adc1_pa0(a, channel)));
|
||||||
|
|
||||||
Timer::after_secs(60).await;
|
let zero = degrees2duty(0.0, pwm_max_dur, pwm_max_duty);
|
||||||
|
pwm.set_duty(Channel::Ch2, zero);
|
||||||
|
Timer::after_millis(500).await;
|
||||||
|
|
||||||
|
for _ in 0..10 {
|
||||||
|
let duty = degrees2duty(SERVO_MIN_DEG, pwm_max_dur, pwm_max_duty);
|
||||||
|
pwm.set_duty(Channel::Ch2, duty);
|
||||||
|
Timer::after_secs(1).await;
|
||||||
|
|
||||||
|
let duty = degrees2duty(SERVO_MAX_DEG, pwm_max_dur, pwm_max_duty);
|
||||||
|
pwm.set_duty(Channel::Ch2, duty);
|
||||||
|
Timer::after_secs(1).await;
|
||||||
|
}
|
||||||
|
|
||||||
|
pwm.set_duty(Channel::Ch2, zero);
|
||||||
|
Timer::after_millis(600).await;
|
||||||
|
|
||||||
treatbot_5k::exit()
|
treatbot_5k::exit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue