Add link to dependices
This commit is contained in:
@@ -26,6 +26,7 @@ extern "C" {
|
||||
#include <SoftwareSerial.h>
|
||||
#include <SerialTransfer.h>
|
||||
#include <PubSubClient.h>
|
||||
#include "CG_RadSens.h"
|
||||
|
||||
#define BAUDRATE 9600
|
||||
|
||||
@@ -61,6 +62,9 @@ float temp, hum;
|
||||
bool bLamp, wLamp, reciever;
|
||||
uint8_t statLamp;
|
||||
|
||||
CG_RadSens radSens(RS_DEFAULT_I2C_ADDRESS); /*Constructor of the class ClimateGuard_RadSens1v2,
|
||||
sets the address parameter of I2C sensor.
|
||||
Default address: 0x66.*/
|
||||
|
||||
AsyncWebServer server(80);
|
||||
struct I2cTxStruct {
|
||||
@@ -90,4 +94,5 @@ PubSubClient client(espClient);
|
||||
boolean reconnect();
|
||||
void callback(char* topic, byte* payload, unsigned int length);
|
||||
|
||||
|
||||
#endif // __MAIN__
|
||||
|
||||
@@ -29,6 +29,7 @@ lib_deps =
|
||||
plerup/EspSoftwareSerial @ ^8.1.0
|
||||
powerbroker2/SerialTransfer @ ^3.1.3
|
||||
knolleary/PubSubClient @ ^2.8
|
||||
climateguard/ClimateGuard RadSens @ ^1.1.3
|
||||
;upload_protocol = espota
|
||||
;upload_port = 192.168.1.138
|
||||
|
||||
|
||||
@@ -126,12 +126,16 @@ void setup() {
|
||||
#undef SCL //delete dafault SCL pin number
|
||||
#define SDA 33 //assign new SDA pin to GPIO1/D2/0TX for all slaves on i2c bus
|
||||
#define SCL 32 //assign new SCL pin to GPIO3/D7/0RX for all slaves on i2c bus
|
||||
Wire.begin(SDA, SCL);
|
||||
if (!htu.begin(SDA, SCL)) {
|
||||
Serial.println("Couldn't find sensor!");
|
||||
while (1);
|
||||
}
|
||||
Serial.println("Sensor found!");
|
||||
|
||||
radSens.init();
|
||||
radSens.setSensitivity(105);
|
||||
|
||||
//char s[8];
|
||||
EEPROM.begin(20);
|
||||
EEPROM.get(0, periodMotion);
|
||||
@@ -331,6 +335,14 @@ void loop() {
|
||||
WebSerial.println("Temp: " + String(temp));
|
||||
WebSerial.println("Hum: " + String(hum));
|
||||
Serial.println(sec);
|
||||
radSens.getRadIntensyDynamic();
|
||||
}
|
||||
if ((sec + 1) % 30 == 0){
|
||||
float mkr = radSens.getRadIntensyStatic();
|
||||
dtostrf(mkr, 6, 1, s);
|
||||
client.publish(TOPIC"mkr", s);
|
||||
WebSerial.println("mkR: " + String(mkr));
|
||||
Serial.println("mkR: " + String(mkr));
|
||||
}
|
||||
itoa(WiFi.RSSI(), s, 10);
|
||||
client.publish(TOPIC"RSSI", s);
|
||||
|
||||
Reference in New Issue
Block a user