#include #include #define ONE_WIRE_BUS 2 OneWire oneWire(ONE_WIRE_BUS); DallasTemperature sensors(&oneWire); void setup(void) { Serial.begin(9600); Serial.println("SMART WATER IoT (Koutkou-Hidri-Skouloufianakis)\n"); sensors.begin(); } void loop(void) { //TEMPERATURE SENSOR sensors.requestTemperatures(); Serial.print("Temperature is: "); Serial.print(sensors.getTempCByIndex(0)); Serial.println(" °C"); //TURBIDITY SENSOR int sensorValue = analogRead(A0); float voltage = sensorValue * (5.0 / 1024.0); float ntu = -1120.4*square(voltage)+ 5742.3*voltage - 4352.9; Serial.print ("Turbidity is: "); Serial.print (voltage); Serial.print (" V "); Serial.print (ntu); Serial.println (" NTU\n"); delay(1500); }