BMP280 work

This commit is contained in:
2023-03-30 19:22:44 +02:00
parent 3b04b070a4
commit 1f18e76622
6 changed files with 27 additions and 16 deletions

View File

@ -10,6 +10,7 @@
#include "BMP280.h"
#include "comperator.h"
#define TEMP_SENSOR_DATA PB4
#define TRANSMITTER_DATA PD0
#define DOOR_PIN PD2
@ -18,9 +19,9 @@
EMPTY_INTERRUPT(WDT_OVERFLOW_vect);
static constexpr uint8_t id = 4;
static constexpr uint8_t id = 1;
static constexpr bool WATCH_DOOR = false;
static constexpr bool BMP_280 = true;
static constexpr bool BMP_280 = false;
static constexpr bool DHT22 = true;
@ -64,8 +65,8 @@ int main()
Comperator comp;
sei();
wdt_set(WDTO_8S);
WDTCSR = 1<<WDIE;
wdt_set(WDTO_2S);
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
uint8_t couter = 200;
@ -85,15 +86,15 @@ int main()
PORTD &= ~(1 << LED_PIN);
uint8_t paket[4] = {0};
paket[1] = 4;
paket[1] = id;
//temperature sensor
if constexpr (DHT22)
{
//debugBlink(false);
uint8_t readret = tempSensor.read();
paket[0] = readret;
tempSensor.read();
paket[0] = 1;
paket[2] = tempSensor.temperature >> 8;
paket[3] = tempSensor.temperature;
transmiter.send(paket, 4);
@ -141,7 +142,7 @@ int main()
transmiter.send(paket, 4);
}
comp.off();
//power(false);
power(false);
}
sleep_mode();
}