Hello,
Can somebody help me, i want to adapt the exemple code of that librarie with and ESP32.
The exemple is for a UNO or MEGA i think.....
Thanks you by advance.
`/*!
#define EC_PIN A1
#define TE_PIN A2
#define ADC_DIGIT 1024.0
#define REFERENCE_VOLTAGE 5.0
/**
- 获取的电导率电压值和温度电压值
*/
float EC_voltage,TE_voltage;
float temp,conductivity;
DFRobot_ECPRO ec;
DFRobot_ECPRO_PT1000 ecpt;
void setup()
{
Serial.begin(115200);
/**
- 校准 ETALONNAGE
*/
EC_voltage = analogRead(EC_PIN) / ADC_DIGIT * REFERENCE_VOLTAGE;
ec.setCalibration(ec.calibrate(EC_voltage));
Serial.print("calibration value is :");
Serial.println(ec.getCalibration());
}
void loop()
{
/**
- 获取温度值 VALEUR TEMPERATURE
/
TE_voltage = analogRead(TE_PIN)/1024.05;
temp= ecpt.convVoltagetoTemperature_C(TE_voltage);
/**
- 获取电导率值 VALEUR CONDUCTIVITE
*/
EC_voltage = analogRead(EC_PIN) / ADC_DIGIT * REFERENCE_VOLTAGE;
conductivity = ec.getEC_us_cm(EC_voltage,temp);
Serial.print("temperature:");
Serial.print(temp);
Serial.print("^C EC:");
Serial.print(conductivity);
Serial.println("us/cm");
delay(1000);
}
`
Hello,
Can somebody help me, i want to adapt the exemple code of that librarie with and ESP32.
The exemple is for a UNO or MEGA i think.....
Thanks you by advance.
`/*!
*/
#include "DFRobot_ECPRO.h"
#define EC_PIN A1
#define TE_PIN A2
#define ADC_DIGIT 1024.0
#define REFERENCE_VOLTAGE 5.0
/**
*/
float EC_voltage,TE_voltage;
float temp,conductivity;
DFRobot_ECPRO ec;
DFRobot_ECPRO_PT1000 ecpt;
void setup()
{
Serial.begin(115200);
/**
*/
EC_voltage = analogRead(EC_PIN) / ADC_DIGIT * REFERENCE_VOLTAGE;
ec.setCalibration(ec.calibrate(EC_voltage));
Serial.print("calibration value is :");
Serial.println(ec.getCalibration());
}
void loop()
{
/**
/
TE_voltage = analogRead(TE_PIN)/1024.05;
temp= ecpt.convVoltagetoTemperature_C(TE_voltage);
/**
*/
EC_voltage = analogRead(EC_PIN) / ADC_DIGIT * REFERENCE_VOLTAGE;
conductivity = ec.getEC_us_cm(EC_voltage,temp);
Serial.print("temperature:");
Serial.print(temp);
Serial.print("^C EC:");
Serial.print(conductivity);
Serial.println("us/cm");
delay(1000);
}
`