Browse Source

:sparkles: adjusted timing and added some logging

Felix Bytow 1 day ago
parent
commit
85329bbef4
2 changed files with 6 additions and 3 deletions
  1. 2 1
      Ravedude.toml
  2. 4 2
      src/main.rs

+ 2 - 1
Ravedude.toml

@@ -2,7 +2,8 @@
 board = "uno"
 board = "uno"
 # After flashing, open the serial console at 57600 baud.
 # After flashing, open the serial console at 57600 baud.
 open-console = true
 open-console = true
-serial-baudrate = 57600
+serial-baudrate = 115200
+port = "/dev/ttyACM0"
 
 
 # For documentation about this file, check here:
 # For documentation about this file, check here:
 # https://github.com/Rahix/avr-hal/blob/main/ravedude/README.md#ravedudetoml-format
 # https://github.com/Rahix/avr-hal/blob/main/ravedude/README.md#ravedudetoml-format

+ 4 - 2
src/main.rs

@@ -8,6 +8,7 @@ use panic_halt as _;
 fn main() -> ! {
 fn main() -> ! {
     let dp = arduino_hal::Peripherals::take().unwrap();
     let dp = arduino_hal::Peripherals::take().unwrap();
     let pins = arduino_hal::pins!(dp);
     let pins = arduino_hal::pins!(dp);
+    let mut serial = arduino_hal::default_serial!(dp, pins, 115200);
 
 
     // for some reason without this the builtin LED would always turn on/off together with the red LED.
     // for some reason without this the builtin LED would always turn on/off together with the red LED.
     let mut builtin_led = pins.d13.into_output();
     let mut builtin_led = pins.d13.into_output();
@@ -25,14 +26,15 @@ fn main() -> ! {
 
 
     loop {
     loop {
         if button.is_high() {
         if button.is_high() {
+            ufmt::uwriteln!(&mut serial, "Button pressed!").unwrap();
             // signal coming
             // signal coming
             yellow_led.set_high();
             yellow_led.set_high();
-            delay_ms(1000);
+            delay_ms(2000);
             // green
             // green
             red_led.set_low();
             red_led.set_low();
             yellow_led.set_low();
             yellow_led.set_low();
             green_led.set_high();
             green_led.set_high();
-            delay_ms(10_000);
+            delay_ms(6_000);
             // signal leaving
             // signal leaving
             green_led.set_low();
             green_led.set_low();
             yellow_led.set_high();
             yellow_led.set_high();