Korekta migotania
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
#include <Wire.h>
|
||||
#include <BH1750.h>
|
||||
#include <Adafruit_GFX.h>
|
||||
#include <Adafruit_SSD1306.h>
|
||||
#define Version "0.1.2"
|
||||
#include <esp_sleep.h>
|
||||
#define Version "0.1.3"
|
||||
|
||||
#define PinLED 2 // on-board LED
|
||||
#define IN1 32
|
||||
@@ -13,26 +12,34 @@
|
||||
#define OLED_RESET -1
|
||||
#define SCREEN_ADDRESS 0x3C
|
||||
|
||||
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
|
||||
// Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
|
||||
BH1750 lightMeter;
|
||||
|
||||
// TaskHandle_t TaskReadLux;
|
||||
|
||||
float lux = 0.0;
|
||||
|
||||
void setup() {
|
||||
|
||||
Serial.begin(9600);
|
||||
Wire.begin();
|
||||
lightMeter.begin();
|
||||
|
||||
if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
|
||||
Serial.println(F("SSD1306 allocation failed"));
|
||||
}
|
||||
// if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
|
||||
// Serial.println(F("SSD1306 allocation failed"));
|
||||
// }
|
||||
// xTaskCreatePinnedToCore(
|
||||
// readLuxTask, "ReadLux", 2048, NULL, 1, &TaskReadLux, 1);
|
||||
|
||||
display.setTextSize(1);
|
||||
display.setTextColor(SSD1306_WHITE);
|
||||
display.clearDisplay();
|
||||
display.setCursor(0, 0);
|
||||
display.println("Version:");
|
||||
display.setCursor(60, 0);
|
||||
display.println(Version);
|
||||
display.display();
|
||||
|
||||
// display.setTextSize(1);
|
||||
// display.setTextColor(SSD1306_WHITE);
|
||||
// display.clearDisplay();
|
||||
// display.setCursor(0, 0);
|
||||
// display.println("Version:");
|
||||
// display.setCursor(60, 0);
|
||||
// display.println(Version);
|
||||
// display.display();
|
||||
|
||||
pinMode(IN1, OUTPUT);
|
||||
pinMode(IN2, OUTPUT);
|
||||
@@ -113,11 +120,14 @@ void loop() {
|
||||
pulsujNaprzemiennie(8); // pełny cykl 8 sekund
|
||||
} else {
|
||||
digitalWrite(PinLED, HIGH);
|
||||
display.setCursor(0, 10);
|
||||
display.println("OFF");
|
||||
delay(5000);
|
||||
// display.setCursor(0, 10);
|
||||
// display.println("OFF");
|
||||
esp_sleep_enable_timer_wakeup(100 * 1000000ULL); // 5s w mikrosekundach
|
||||
esp_light_sleep_start();
|
||||
|
||||
}
|
||||
// display.display();
|
||||
|
||||
}
|
||||
|
||||
|
||||
display.display();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user