Update light_fast.ino

would probably work ...  dk
This commit is contained in:
i3le 2024-07-11 19:02:28 +02:00
parent 269e012679
commit 23c0ccd7b5

View file

@ -1,3 +1,6 @@
#include <SoftwareSerial.h>
SoftwareSerial mySerial(3, 4);
#define Light_sensor A0
#define Lamp_mod 6
#define Move_sensor 2
@ -52,9 +55,7 @@ void movement(){
else{
movement_threshold = 80;
}
if (Serial.availableForWrite()) {
if (movement_threshold-25 > 0) Serial.write(movement_threshold-25);
}
if (movement_threshold-25 > 0) mySerial.write(movement_threshold-25);
}
void setup() {
@ -64,6 +65,7 @@ void setup() {
pinMode(Light_sensor,INPUT);
pinMode(Lamp_mod,OUTPUT);
Serial.begin(9600);
mySerial.begin(38400);
}
// functions werte definiert von 0 bis 100 darüber und unter chaos!
@ -110,13 +112,12 @@ void loop() {
setlight_with_wehtherinfluence(movement_threshold);
delay(100);
int8_t i;
while ((Serial.available())&&(i<10) ){
uint8_t msg = Serial.read();
while (mySerial.available()){
uint8_t msg = mySerial.read();
Serial.println(msg);
if (msg < 101){
if ( msg >= movement_threshold ) movement_threshold= msg;
}
i++;
}
}