#include <FastLED.h>
#define NUM_LEDS 10 /*the number of leds that will light. If */
//****************************
#define DATA_PIN 8 // Connect to the data wires on the pixel strips
CRGB leds[NUM_LEDS]; // sets number of pixels that will light on each strip.
//*****************************************************
#define waterLevelP 15
#define relayP1 2
#define relayP2 4
bool enable = true;
int waterLevel = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(waterLevelP, INPUT);
pinMode(relayP1, OUTPUT);
pinMode(relayP2, OUTPUT);
waterLevel = analogRead(15);
digitalWrite(relayP2, HIGH);
}
void loop() {
// put your main code here, to run repeatedly:
waterLevel = analogRead(15);
Serial.println(enable);
if (waterLevel < 1000) {
Serial.println("Prižigam pumpo.");
digitalWrite(relayP1, LOW);
enable = true;
}
else {
Serial.println("Ugašam pumpo/prižigam piezo.");
digitalWrite(relayP1, HIGH);
if (enable) {
Serial.println("Pritisk gumba");
delay(1000);
digitalWrite(relayP2, LOW);
delay(2000);
digitalWrite(relayP2, HIGH);
enable = false;
}
}
}