W trakcie loggowania temp
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
#include "SD.h"
|
#include "SD.h"
|
||||||
#include "SPI.h"
|
#include "SPI.h"
|
||||||
|
|
||||||
#define Version "menu : 0.4batt"
|
#define Version "0.1"
|
||||||
#define WIRE Wire
|
#define WIRE Wire
|
||||||
#define DHTTYPE DHT22
|
#define DHTTYPE DHT22
|
||||||
#define DHTPIN 4
|
#define DHTPIN 4
|
||||||
@@ -89,13 +89,14 @@ void setup() {
|
|||||||
}else {
|
}else {
|
||||||
Serial.println("Karta SD wykryta!");
|
Serial.println("Karta SD wykryta!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
display.setCursor(0,16);
|
display.setCursor(0,16);
|
||||||
|
|
||||||
// Tworzenie pliku
|
// Tworzenie pliku
|
||||||
File file = SD.open("/dane.txt", FILE_WRITE);
|
File file = SD.open("/TempHumLog.txt", FILE_APPEND);
|
||||||
if (file) {
|
if (file) {
|
||||||
file.println("Dane zapisane z ESP32!");
|
file.println("Dane zapisane z ESP32! V2");
|
||||||
|
file.println(Version);
|
||||||
|
file.println("DataCzas; Temp; Humi; Feel");
|
||||||
file.close();
|
file.close();
|
||||||
display.println("Plik utworzony!");
|
display.println("Plik utworzony!");
|
||||||
|
|
||||||
@@ -106,14 +107,14 @@ void setup() {
|
|||||||
}
|
}
|
||||||
display.display();
|
display.display();
|
||||||
delay(500);
|
delay(500);
|
||||||
// rtc.adjust(DateTime(2025,2,15, 17, 44,59));
|
|
||||||
|
|
||||||
//setup END
|
//setup END
|
||||||
|
//######################
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
////DIAG menu nr diag
|
////DIAGNOSTIC menu nr diag
|
||||||
// display.setCursor(75, 16);
|
// display.setCursor(75, 16);
|
||||||
// display.println(menuL0);
|
// display.println(menuL0);
|
||||||
// display.setCursor(90, 16);
|
// display.setCursor(90, 16);
|
||||||
@@ -134,10 +135,31 @@ void loop() {
|
|||||||
hourss = now.hour();
|
hourss = now.hour();
|
||||||
mins = now.minute();
|
mins = now.minute();
|
||||||
secs = now.second();
|
secs = now.second();
|
||||||
|
sprintf(dateString, "%02d/%02d/%4d %02d:%02d:%02d", now.day(), now.month(), now.year(), now.hour(), now.minute(), now.second());
|
||||||
|
|
||||||
|
if (mins % 1 == 0 && secs == 0) {
|
||||||
|
|
||||||
|
|
||||||
|
File file = SD.open("/TempHumLog.txt", FILE_APPEND);
|
||||||
|
if (file) {
|
||||||
|
display.fillRect(0, 0, 124, 64, SSD1306_WHITE);
|
||||||
|
file.print(dateString);
|
||||||
|
file.print("; ");
|
||||||
|
file.print(temp, 1);
|
||||||
|
file.print("; ");
|
||||||
|
file.print(hum, 1);
|
||||||
|
file.print("; ");
|
||||||
|
file.println(heat_idx, 1);
|
||||||
|
file.close();
|
||||||
|
delay(1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//zapis na SD:
|
||||||
|
|
||||||
if (menuL0 == 10 ) {
|
if (menuL0 == 10 ) {
|
||||||
// ############# MENU TEMP
|
// ############# MENU TEMP
|
||||||
sprintf(dateString, "%02d/%02d/%4d %02d:%02d:%02d", now.day(), now.month(), now.year(), now.hour(), now.minute(), now.second());
|
|
||||||
display.setCursor(0, 0);
|
display.setCursor(0, 0);
|
||||||
display.println(dateString);
|
display.println(dateString);
|
||||||
|
|
||||||
@@ -160,9 +182,9 @@ void loop() {
|
|||||||
display.setCursor(0, 24);
|
display.setCursor(0, 24);
|
||||||
display.println("Odczuwalna:");
|
display.println("Odczuwalna:");
|
||||||
display.setCursor(85, 24);
|
display.setCursor(85, 24);
|
||||||
display.println(heat_idx);
|
display.println(heat_idx);
|
||||||
display.setCursor(120,24);
|
display.setCursor(120,24);
|
||||||
display.println("C");
|
display.println("C");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -256,24 +278,22 @@ void loop() {
|
|||||||
display.print("Ustaw sekundy na 0");
|
display.print("Ustaw sekundy na 0");
|
||||||
|
|
||||||
|
|
||||||
if (digitalRead(BTN_ENTER) == HIGH and menuL2 == 10) {
|
if (digitalRead(BTN_ENTER) == HIGH and menuL2 == 10) {
|
||||||
menuL2 = 9;
|
menuL2 = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (menuL2 == 9){
|
|
||||||
display.setCursor(0,16);
|
|
||||||
display.print("Sekundy = 0");
|
|
||||||
delay(250);
|
|
||||||
if (digitalRead(BTN_ENTER) == HIGH) {
|
|
||||||
menuL2 = 10;
|
|
||||||
rtc.adjust(DateTime(now.year(), now.month(), now.day(), now.hour(), now.minute(),0));
|
|
||||||
minsToSet = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (menuL2 == 9){
|
||||||
|
display.setCursor(0,16);
|
||||||
|
display.print("Sekundy = 0");
|
||||||
|
delay(250);
|
||||||
|
if (digitalRead(BTN_ENTER) == HIGH) {
|
||||||
|
menuL2 = 10;
|
||||||
|
rtc.adjust(DateTime(now.year(), now.month(), now.day(), now.hour(), now.minute(),0));
|
||||||
|
minsToSet = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (menuL1 == 6) {
|
if (menuL1 == 6) {
|
||||||
display.setCursor(0, 8);
|
display.setCursor(0, 8);
|
||||||
display.print("Wyjdz");
|
display.print("Wyjdz");
|
||||||
@@ -284,9 +304,6 @@ void loop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (menuL0 == 8 ) {
|
if (menuL0 == 8 ) {
|
||||||
display.setCursor(0, 0);
|
display.setCursor(0, 0);
|
||||||
display.print("MENU TECH");
|
display.print("MENU TECH");
|
||||||
@@ -309,7 +326,6 @@ void loop() {
|
|||||||
display.print("xxx");
|
display.print("xxx");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (digitalRead(BTN_UP) == HIGH) {
|
if (digitalRead(BTN_UP) == HIGH) {
|
||||||
display.setCursor(0, 24);
|
display.setCursor(0, 24);
|
||||||
display.print("UP");
|
display.print("UP");
|
||||||
@@ -325,48 +341,45 @@ void loop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (digitalRead(BTN_UP) == HIGH and menuL0 <10 ) {
|
if (digitalRead(BTN_UP) == HIGH and menuL0 <10 ) {
|
||||||
if ( menuL0 < 10 && menuL1 == 10 ) {
|
if ( menuL0 < 10 && menuL1 == 10 ) {
|
||||||
menuL0 = menuL0 + 1;
|
menuL0 = menuL0 + 1;
|
||||||
|
}
|
||||||
|
if (menuL1 < 9 && menuL2 == 10) {
|
||||||
|
menuL1 = menuL1 + 1;
|
||||||
|
}
|
||||||
|
if (menuL2 < 9 and menuL0 != 10 and menuL1 != 10) {
|
||||||
|
menuL2 = menuL2 + 1;
|
||||||
|
}
|
||||||
|
if (menuL2 == 9 and minsToSet <59)
|
||||||
|
{
|
||||||
|
minsToSet = minsToSet + 1;
|
||||||
|
}
|
||||||
|
if (menuL2 == 9 and hoursToSet < 23)
|
||||||
|
{
|
||||||
|
hoursToSet = hoursToSet + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (menuL1 < 9 && menuL2 == 10) {
|
|
||||||
menuL1 = menuL1 + 1;
|
|
||||||
}
|
|
||||||
if (menuL2 < 9 and menuL0 != 10 and menuL1 != 10) {
|
|
||||||
menuL2 = menuL2 + 1;
|
|
||||||
}
|
|
||||||
if (menuL2 == 9 and minsToSet <59)
|
|
||||||
{
|
|
||||||
minsToSet = minsToSet + 1;
|
|
||||||
}
|
|
||||||
if (menuL2 == 9 and hoursToSet < 23)
|
|
||||||
{
|
|
||||||
hoursToSet = hoursToSet + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (digitalRead(BTN_DOWN) == HIGH and menuL0 >= 8) {
|
if (digitalRead(BTN_DOWN) == HIGH and menuL0 >= 8) {
|
||||||
if (menuL0 > 8 && menuL1 == 10 ) {
|
if (menuL0 > 8 && menuL1 == 10 ) {
|
||||||
menuL0 = menuL0 - 1;
|
menuL0 = menuL0 - 1;
|
||||||
|
}
|
||||||
|
if (menuL1 > 6 and menuL1 <= 9 && menuL2 == 10) {
|
||||||
|
menuL1 = menuL1 - 1;
|
||||||
|
}
|
||||||
|
if (menuL2 > 6 and menuL2 < 9 and menuL0 != 10 and menuL1 != 10 ) {
|
||||||
|
menuL2 = menuL2 - 1;
|
||||||
|
}
|
||||||
|
if (menuL2 == 9 and minsToSet > 1)
|
||||||
|
{
|
||||||
|
minsToSet = minsToSet - 1;
|
||||||
|
}
|
||||||
|
if (menuL2 == 9 and hoursToSet > 1)
|
||||||
|
{
|
||||||
|
hoursToSet = hoursToSet - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (menuL1 > 6 and menuL1 <= 9 && menuL2 == 10) {
|
|
||||||
menuL1 = menuL1 - 1;
|
|
||||||
}
|
|
||||||
if (menuL2 > 6 and menuL2 < 9 and menuL0 != 10 and menuL1 != 10 ) {
|
|
||||||
menuL2 = menuL2 - 1;
|
|
||||||
}
|
|
||||||
if (menuL2 == 9 and minsToSet > 1)
|
|
||||||
{
|
|
||||||
minsToSet = minsToSet - 1;
|
|
||||||
}
|
|
||||||
if (menuL2 == 9 and hoursToSet > 1)
|
|
||||||
{
|
|
||||||
hoursToSet = hoursToSet - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
display.display();
|
display.display();
|
||||||
delay(150);
|
delay(150);
|
||||||
|
|||||||
Reference in New Issue
Block a user