Soil Moisture Sensor with gauge

the code runs with fishno board

#define BLYNK_PRINT Serial
#include <OneWire.h>
#include <DallasTemperature.h>
#include <SPI.h>
#include <Fishino.h>
#include <BlynkSimpleFishino.h>
#include <TimeLib.h>
#include <WidgetRTC.h>
char auth[] = "962a607a6a01458fbf5c3437aexxxxxx";
#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
float tempout = 0;
DallasTemperature sensors(&oneWire);
BlynkTimer timer;

char Date[16];
char Time[16];
int sensorValue = 0;
int sensorPin = A0;
int sensorValuePercent = 0;
WidgetRTC rtc;
void clockdata()
{
  sprintf(Time, "%02d:%02d:%02d", hour(), minute(), second());
  sprintf(Date, "%02d/%02d/%04d", day(), month(), year());
  Serial.print("Uhrzeit und Datum ");
  Serial.print(Time);
  Serial.print(" ");
  Serial.print(Date);
  Serial.println();
  Blynk.virtualWrite(V1, Time);
  Blynk.virtualWrite(V2, Date);
}
void Twitter(){
  Blynk.tweet (String ("Temperatur ist : ") + sensors.getTempCByIndex(0) + "°C / Bodenfeuchte ist : " + sensorValue + "% um " + (Time) + " am " + (Date));
}
void Bodenfeucht(){
  
  sensorValue = analogRead(sensorPin);
  sensorValue = map(sensorValue, 0, 1023, 1023, 0);
  sensorValuePercent = (sensorValue / 1023) * 100;
  Serial.print (String ("Bodenfeuchte ist : ") + sensorValue = analogRead(sensorPin));
  Blynk.virtualWrite(V7, sensorValue);
}
void Temperaturmessung(){

  sensors.requestTemperatures();
  tempout = (sensors.getTempCByIndex(0));
  Serial.print (String ("Temperatur ist : ") + sensors.getTempCByIndex(0));
  Blynk.virtualWrite(V4, tempout);
  if (tempout < 9.99) {
    
    Blynk.setProperty(V4, "label", "arsch kalt °C");
  }
  if (tempout > 10 && tempout < 19) {
    
    Blynk.setProperty(V4, "label", "Temperatur normal °C");
  }
  if (tempout > 20 && tempout < 69.99) {
    
    Blynk.setProperty(V4, "label", "schön warm °C");
  }
}
void setup()
{
  // Debug console
  Serial.begin(9600);
rtc.begin();
timer.setInterval(1000, clockdata);
timer.setInterval(1000, Bodenfeucht);
timer.setInterval(1000, Temperaturmessung);
timer.setInterval(15000, Twitter);
Blynk.begin(auth, "");

}

void loop()
{
  Blynk.run();
  timer.run();
}
1 Like