KorMYS filter lightlevel
This commit is contained in:
@@ -8,10 +8,11 @@
|
||||
#define MY_RADIO_RF24
|
||||
#define MY_RF24_CHANNEL (105)
|
||||
#define MY_RF24_PA_LEVEL RF24_PA_MAX
|
||||
//#define MY_REPEATER_FEATURE
|
||||
|
||||
#define MY_DEFAULT_ERR_LED_PIN (4) // Error led pin
|
||||
#define MY_DEFAULT_RX_LED_PIN (5) // Receive led pin
|
||||
#define MY_DEFAULT_TX_LED_PIN (6) // the PCB, on board LED
|
||||
#define MY_DEFAULT_ERR_LED_PIN (A3) // Error led pin
|
||||
#define MY_DEFAULT_RX_LED_PIN (A2) // Receive led pin
|
||||
#define MY_DEFAULT_TX_LED_PIN (A1) // the PCB, on board LED
|
||||
|
||||
#include <MySensors.h>
|
||||
#include <SoftwareSerial.h> // Remove if using HardwareSerial or non-uno compatabile device
|
||||
@@ -21,7 +22,7 @@
|
||||
#define TX_PIN 7
|
||||
#define BAUDRATE 9600
|
||||
|
||||
#define MOTION (7)
|
||||
#define MOTION (4)
|
||||
#define LED_WHITE (5)
|
||||
#define LED_BLUE (6)
|
||||
MHZ19 myMHZ19;
|
||||
@@ -34,7 +35,6 @@ uint8_t curDelay;
|
||||
uint8_t spLight, dbLight;
|
||||
uint16_t levelBlue, levelWhite;
|
||||
bool move, lightWhite;
|
||||
|
||||
|
||||
float temp, hum;
|
||||
|
||||
#endif
|
||||
@@ -20,7 +20,7 @@ void setup() {
|
||||
myMHZ19.begin(mySerial); // *Important, Pass your Stream reference here
|
||||
myMHZ19.autoCalibration(false);
|
||||
|
||||
/* char myVersion[4];
|
||||
char myVersion[4];
|
||||
myMHZ19.getVersion(myVersion);
|
||||
Serial.print("\nFirmware Version: ");
|
||||
for(byte i = 0; i < 4; i++)
|
||||
@@ -37,7 +37,7 @@ void setup() {
|
||||
Serial.println(myMHZ19.getBackgroundCO2());
|
||||
Serial.print("Temperature Cal: ");
|
||||
Serial.println(myMHZ19.getTempAdjustment());
|
||||
Serial.print("ABC Status: "); myMHZ19.getABC() ? Serial.println("ON") : Serial.println("OFF");*/
|
||||
Serial.print("ABC Status: "); myMHZ19.getABC() ? Serial.println("ON") : Serial.println("OFF");
|
||||
periodMinCO2 = loadState(0);
|
||||
if(periodMinCO2 == 0) periodMinCO2 = 1;
|
||||
periodMotion = loadState(1);
|
||||
@@ -53,7 +53,6 @@ void loop() {
|
||||
static uint32_t cRun = millis();
|
||||
static uint8_t sec = 0;
|
||||
static uint8_t minuts = 0;
|
||||
float temp, hum;
|
||||
|
||||
if(digitalRead(MOTION) > 0){
|
||||
if(curDelay == -1) sendDataB(msgMove, true);
|
||||
@@ -86,6 +85,8 @@ void loop() {
|
||||
if((sec + 2) % 30 == 0){
|
||||
temp = myHTU21D.readTemperature();
|
||||
hum = myHTU21D.readCompensatedHumidity();
|
||||
Serial.println("Temp: " + String(temp));
|
||||
Serial.println("Hum: " + String(hum));
|
||||
}
|
||||
if(sec == 59){
|
||||
minuts++;
|
||||
@@ -101,7 +102,14 @@ void loop() {
|
||||
sendDataI(msgCO2, CO2);
|
||||
wait(50);
|
||||
}
|
||||
else{
|
||||
Serial.println("CO2err:" + String(myMHZ19.errorCode));
|
||||
}
|
||||
if(temp != HTU21D_ERROR){
|
||||
Serial.println("Send");
|
||||
|
||||
Serial.println("Temp: " + String(temp));
|
||||
Serial.println("Hum: " + String(hum));
|
||||
sendDataF(msgTemp, temp);
|
||||
wait(50);
|
||||
sendDataF(msgHum, hum);
|
||||
|
||||
Reference in New Issue
Block a user