Korekta czasów i setupu
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#include <Adafruit_GFX.h>
|
#include <Adafruit_GFX.h>
|
||||||
#include <Adafruit_SSD1306.h>
|
#include <Adafruit_SSD1306.h>
|
||||||
#define Version "0.1"
|
#define Version "0.2"
|
||||||
#define SCREEN_WIDTH 128
|
#define SCREEN_WIDTH 128
|
||||||
#define SCREEN_HEIGHT 32
|
#define SCREEN_HEIGHT 32
|
||||||
#define OLED_RESET -1
|
#define OLED_RESET -1
|
||||||
@@ -24,13 +24,13 @@ int moisture = 0;
|
|||||||
int watertingCnt = 0;
|
int watertingCnt = 0;
|
||||||
int minValue = 5000;
|
int minValue = 5000;
|
||||||
int maxValue = 0;
|
int maxValue = 0;
|
||||||
int waitSec = 16;
|
int waitSec = 96;
|
||||||
int waitMs = 1000 * waitSec;
|
int waitMs = 1000 * waitSec;
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
pinMode(WTR_SENSOR, INPUT_PULLDOWN);
|
pinMode(WTR_SENSOR, INPUT_PULLDOWN);
|
||||||
pinMode(PIN_PUMP, OUTPUT);
|
pinMode(PIN_PUMP, OUTPUT);
|
||||||
digitalWrite(PIN_PUMP, LOW);
|
digitalWrite(PIN_PUMP, HIGH);
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
|
if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
|
||||||
Serial.println(F("SSD1306 allocation failed"));
|
Serial.println(F("SSD1306 allocation failed"));
|
||||||
@@ -98,7 +98,7 @@ if (moisture < minValue){
|
|||||||
Serial.println("Status: Soil is too dry - time to water!");
|
Serial.println("Status: Soil is too dry - time to water!");
|
||||||
digitalWrite(PIN_PUMP, LOW);
|
digitalWrite(PIN_PUMP, LOW);
|
||||||
watertingCnt++;
|
watertingCnt++;
|
||||||
delay(waitMs/4);
|
delay(waitMs/16);
|
||||||
digitalWrite(PIN_PUMP, HIGH);
|
digitalWrite(PIN_PUMP, HIGH);
|
||||||
}
|
}
|
||||||
Serial.println();
|
Serial.println();
|
||||||
|
|||||||
Reference in New Issue
Block a user