Skip to content

Commit

Permalink
Comment out turn on/off soil moisture sensor, EEPROM values
Browse files Browse the repository at this point in the history
  • Loading branch information
vitzaoral committed Jul 10, 2018
1 parent 3840bc2 commit 8ecf3b8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/InternetConnection/InternetConnection.cpp
Expand Up @@ -78,7 +78,7 @@ BLYNK_WRITE(V25)
Blynk.virtualWrite(V26, requiredPower);
Serial.println("Target power for pump 1 is " + String(requiredPower) + "%%");
// map(hodnota, minimumPůvodníStupnice, maximumPůvodníStupnice, minimumNovéStupnice, maximumNovéStupnice);
int result = map(requiredPower, 0, 100, 0, 1024);
int result = map(requiredPower, 0, 100, 0, 1023);
setToEEPROM(EEPROM_PUMP1_POWER_ADDRESS, result);
}

Expand All @@ -89,7 +89,7 @@ BLYNK_WRITE(V27)
Blynk.virtualWrite(V28, requiredPower);
Serial.println("Target power for pump 2 is " + String(requiredPower) + "%%");
// map(hodnota, minimumPůvodníStupnice, maximumPůvodníStupnice, minimumNovéStupnice, maximumNovéStupnice);
int result = map(requiredPower, 0, 100, 0, 1024);
int result = map(requiredPower, 0, 100, 0, 1023);
setToEEPROM(EEPROM_PUMP2_POWER_ADDRESS, result);
}

Expand Down
14 changes: 7 additions & 7 deletions lib/SoilMoisture/SoilMoisture.cpp
Expand Up @@ -4,7 +4,7 @@
#define MUX_A D0
#define MUX_B D5
#define MUX_C D6
#define MOSFET RX
//#define MOSFET RX
#define ANALOG_INPUT A0

void SoilMoisture::initialize()
Expand All @@ -13,7 +13,7 @@ void SoilMoisture::initialize()
pinMode(MUX_A, OUTPUT);
pinMode(MUX_B, OUTPUT);
pinMode(MUX_C, OUTPUT);
pinMode(MOSFET, OUTPUT);
// pinMode(MOSFET, OUTPUT);
}

void SoilMoisture::changeMux(int c, int b, int a)
Expand All @@ -36,9 +36,9 @@ SoilMoistureStatus SoilMoisture::getSoilMoistureStatus()
{
SoilMoistureStatus status = {0, 0, 0, 0, 0};

digitalWrite(MOSFET, HIGH);
Serial.println("Soil moisture sensors ON");
delay(100);
// digitalWrite(MOSFET, HIGH);
// Serial.println("Soil moisture sensors ON");
// delay(100);

changeMux(LOW, LOW, LOW);
int value = analogRead(ANALOG_INPUT); //Value of the sensor connected Option 0 pin of Mux
Expand Down Expand Up @@ -79,8 +79,8 @@ SoilMoistureStatus SoilMoisture::getSoilMoistureStatus()
// changeMux(HIGH, HIGH, HIGH);
// value = analogRead(ANALOG_INPUT); //Value of the sensor connected Option 7 pin of Mux

digitalWrite(MOSFET, LOW);
Serial.println("Soil moisture sensors OFF");
// digitalWrite(MOSFET, LOW);
// Serial.println("Soil moisture sensors OFF");

return status;
}
Expand Down
2 changes: 1 addition & 1 deletion platformio.ini
Expand Up @@ -13,5 +13,5 @@ platform = espressif8266
board = d1_mini
framework = arduino
; OTA settings
; upload_port = "10.0.0.3"
; upload_port = "10.0.0.2"
; upload_flags = --auth="otaPasswordWatering"
3 changes: 3 additions & 0 deletions src/main.cpp
Expand Up @@ -4,6 +4,7 @@
#include <Watering.h>
#include <SoilMoisture.h>
#include <Ticker.h>
#include <EEPROM.h>

const int sendDataToInternetInterval = 30000;

Expand Down Expand Up @@ -67,6 +68,8 @@ void updateTimers()

void setup()
{
// Two bytes for power of pump1 and pump2
EEPROM.begin(2);
Serial.begin(9600);
delay(100);
Watering::initialize();
Expand Down

0 comments on commit 8ecf3b8

Please sign in to comment.