Change KorMYS LED Inv
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
// Set blinking period
|
||||
#define MY_DEFAULT_LED_BLINK_PERIOD 300
|
||||
// Inverses the behavior of leds
|
||||
#define MY_WITH_LEDS_BLINKING_INVERSE
|
||||
//#define MY_WITH_LEDS_BLINKING_INVERSE
|
||||
// Flash leds on rx/tx/err
|
||||
#define MY_DEFAULT_ERR_LED_PIN A3 // Error led pin
|
||||
#define MY_DEFAULT_TX_LED_PIN A4 // the PCB, on board LED
|
||||
@@ -30,6 +30,7 @@ bool lamp;
|
||||
#define RX_PIN 2
|
||||
#define TX_PIN 3
|
||||
#define LAMP_OUT 5
|
||||
#define PIN_MOVE 7
|
||||
SoftwareSerial sSerial(RX_PIN, TX_PIN);
|
||||
SDS011 sds;
|
||||
|
||||
@@ -58,7 +59,7 @@ void setup()
|
||||
//Serial.println(sds.setCustomWorkingPeriod(3).toString()); // sensor sends data every 3 minutes
|
||||
//sds.setActiveReportingMode();
|
||||
//sds.setCustomWorkingPeriod(1);
|
||||
pinMode(A1, INPUT_PULLUP);
|
||||
pinMode(PIN_MOVE, INPUT_PULLUP);
|
||||
pinMode(LAMP_OUT, OUTPUT);
|
||||
//digitalWrite(7, HIGH);
|
||||
//saveState(6, 2);
|
||||
@@ -98,9 +99,8 @@ void loop()
|
||||
{
|
||||
float p25, p10;
|
||||
uint32_t curTime;
|
||||
//move = digitalRead(A1);
|
||||
|
||||
if(digitalRead(A1) > 0){
|
||||
if(digitalRead(PIN_MOVE) > 0){
|
||||
if(curDelay == -1) sendData(msgMove, true);
|
||||
move = true;
|
||||
curDelay = timeDelay;
|
||||
@@ -127,8 +127,8 @@ void loop()
|
||||
}
|
||||
}
|
||||
else if((adc > (minLight + minLightDB)) || (move == 0)){
|
||||
//analogWrite(LAMP_OUT, 0);
|
||||
curDelay = 2;
|
||||
analogWrite(LAMP_OUT, 0);
|
||||
//curDelay = 2;
|
||||
if(lamp == true){
|
||||
Serial.println("Lamp OFF");
|
||||
Serial.print("ADC: ");Serial.print(adc);
|
||||
@@ -169,14 +169,14 @@ void loop()
|
||||
send(msgMillis.set(ms));
|
||||
}
|
||||
}
|
||||
if(lamp && curTime > millis()){
|
||||
/*if(lamp && curTime > millis()){
|
||||
uint8_t ll = int(LightInt - LightInt * (1 - curTime - millis() / float(fadeTime * 1000)));
|
||||
analogWrite(LAMP_OUT, ll);
|
||||
if(curTime - millis() < 10){
|
||||
lamp = false;
|
||||
analogWrite(LAMP_OUT, 0);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
void receive(const MyMessage &message)
|
||||
|
||||
Reference in New Issue
Block a user