Update light_fast.ino
would probably work ... dk
This commit is contained in:
parent
269e012679
commit
23c0ccd7b5
|
@ -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!
|
||||
|
@ -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++;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue