General Gravity

Gravity EC v2 can not calibrate second point

userHead chanaweerom 2022-07-12 12:37:20 257 Views3 Replies
2022-07-12 15:49:11

#include "DFRobot_EC.h"#include <EEPROM.h>

#define EC_PIN A1float voltage,ecValue,temperature = 25;DFRobot_EC ec;

#include "DHT.h"#define DHTPIN 2#define DHTTYPE DHT22DHT dht(DHTPIN, DHTTYPE);void setup(){ Serial.begin(115200);   dht.begin(); ec.begin();}

void loop(){   static unsigned long timepoint = millis();   if(millis()-timepoint>1000U)  //time interval: 1s   {     float h = dht.readHumidity(); // ดึงค่าความชื้น     float t = dht.readTemperature();     timepoint = millis();     voltage = analogRead(EC_PIN)/1024.0*5000;   // read the voltage     temperature = t;     ecValue =  ec.readEC(voltage,temperature);  // convert voltage to EC with temperature compensation     Serial.print("temperature:");     Serial.print(temperature,1);     Serial.print("^C  EC:");     Serial.print(ecValue,2);     Serial.println("ms/cm");   }   ec.calibration(voltage,temperature);          // calibration process by Serail CMD}

userHeadPic chanaweerom
2022-07-12 15:39:39

Hello, which sample code do you use ?

userHeadPic YoannR
chanaweerom wrote:

#include "DFRobot_EC.h"#include <EEPROM.h>

#define EC_PIN A1float voltage,ecValue,temperature = 25;DFRobot_EC ec;

#include "DHT.h"#define DHTPIN 2#define DHTTYPE DHT22DHT dht(DHTPIN, DHTTYPE);void setup(){ Serial.begin(115200);   dht.begin(); ec.begin();}

void loop(){   static unsigned long timepoint = millis();   if(millis()-timepoint>1000U)  //time interval: 1s   {     float h = dht.readHumidity(); // ดึงค่าความชื้น     float t = dht.readTemperature();     timepoint = millis();     voltage = analogRead(EC_PIN)/1024.0*5000;   // read the voltage     temperature = t;     ecValue =  ec.readEC(voltage,temperature);  // convert voltage to EC with temperature compensation     Serial.print("temperature:");     Serial.print(temperature,1);     Serial.print("^C  EC:");     Serial.print(ecValue,2);     Serial.println("ms/cm");   }   ec.calibration(voltage,temperature);          // calibration process by Serail CMD}

2022-07-12 15:49:18
1 Replies