mirror of https://git.eddie.sh/onyx/onyx.git
basics keeb
This commit is contained in:
parent
4f1d9d1029
commit
2295fd97b4
|
@ -10,7 +10,7 @@ cortex-m = "0.6.0"
|
|||
cortex-m-rt = "0.6.10"
|
||||
cortex-m-semihosting = "0.3.3"
|
||||
panic-halt = "0.2.0"
|
||||
metro_m0 = "0.6.0"
|
||||
metro_m0 = { version = "0.6.0", features = ["default", "unproven"] }
|
||||
|
||||
# Uncomment for the panic example.
|
||||
# panic-itm = "0.4.1"
|
||||
|
|
10
src/main.rs
10
src/main.rs
|
@ -27,10 +27,16 @@ fn main() -> ! {
|
|||
);
|
||||
let mut pins = hal::Pins::new(peripherals.PORT);
|
||||
let mut red_led = pins.d13.into_push_pull_output(&mut pins.port);
|
||||
let switch = pins.d3.into_pull_down_input(&mut pins.port);
|
||||
|
||||
let mut delay = Delay::new(core.SYST, &mut clocks);
|
||||
|
||||
loop {
|
||||
delay.delay_ms(1000u16);
|
||||
red_led.toggle();
|
||||
// delay.delay_ms(255u8);
|
||||
if switch.is_high().unwrap() {
|
||||
red_led.set_high().unwrap();
|
||||
} else {
|
||||
red_led.set_low().unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue