diff --git a/light_fast.ino b/light_fast.ino index 8f8b1f0..330602e 100644 --- a/light_fast.ino +++ b/light_fast.ino @@ -1,3 +1,6 @@ +#include +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! @@ -109,14 +111,13 @@ void loop() { if (movement_threshold) movement_threshold--; // time based light reduction! 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++; } } \ No newline at end of file