From 7b989cea315e2dc772ebf009f9a00f8f12867c3d Mon Sep 17 00:00:00 2001 From: i3le Date: Thu, 11 Jul 2024 19:22:35 +0200 Subject: [PATCH] Update light_fast.ino shuld work --- light_fast.ino | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/light_fast.ino b/light_fast.ino index 80664f3..af98c7b 100644 --- a/light_fast.ino +++ b/light_fast.ino @@ -55,13 +55,16 @@ void movement(){ else{ movement_threshold = 80; } - if (movement_threshold-25 > 0){ - mySerial.write(movement_threshold-25); - Serial.print("Msg Send:"); - Serial.println(movement_threshold-25); - } + sendnetsteck(-25); } +void sendnetsteck(int8_t livx){ + if (movement_threshold-livx > 0){ + mySerial.write(movement_threshold-livx); + Serial.print("Msg Send:"); + Serial.println(movement_threshold-livx); + } +} void setup() { delay(random(0, 20)); pinMode(Move_sensor,INPUT); @@ -120,7 +123,10 @@ void loop() { uint8_t msg = mySerial.read(); Serial.println(msg); if (msg < 101){ - if ( msg >= movement_threshold ) movement_threshold= msg; + if ( msg >= movement_threshold ){ + movement_threshold= msg; + sendnetsteck(-25); + } } }