basics keeb

This commit is contained in:
Edward Shen 2020-01-26 13:28:35 -05:00
parent 4f1d9d1029
commit 2295fd97b4
No known key found for this signature in database
GPG Key ID: 19182661E818369F
2 changed files with 9 additions and 3 deletions

View File

@ -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"

View File

@ -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();
}
}
}