From 59021bb5a6e6ad0fdd99850c701ccfa3ebae9c7e Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Tue, 25 Aug 2026 10:30:37 +0200 Subject: [PATCH] feat: instruction handling --- src/gpio_utils.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gpio_utils.rs b/src/gpio_utils.rs index 954983e..4214727 100644 --- a/src/gpio_utils.rs +++ b/src/gpio_utils.rs @@ -129,12 +129,17 @@ impl GPIOController { .out_pins .get(&instruction.topic) .expect("Failed to load pins data"); - println!("Hello World, pin {}", pin.id); let mut instr = "".to_string(); for c in &instruction.payload { instr.push(*c as char) } - println!("{}", instr); + if instr == "ON" { + pin.gpio.set_high(); + } else if instr == "OFF" { + pin.gpio.set_low(); + } else { + println!("Received unknown instruction", instr); + } if pin.off_timeout > 0 { self.timeout_topics .push((pin.topic.clone(), SystemTime::now(), pin.off_timeout));