Skip to content

ESP32 TTGO LoRa Adaptation EC Dfrobot probe #2

@Alinus06

Description

@Alinus06

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.0
    5;
    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);
}
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions