Hirdetés

Új hozzászólás Aktív témák

  • szuszinho

    őstag

    Sziasztok,

    Miért nem olvassa ki folyamatosan a következő kód a hőmérséklet értéket, miközben, ha a cél hőmérsékletet változtatom, az működik?

    Main rész:

    void loop()
    {
    // this call interprets characters from the serial port
    // its a very basic control to allow adjustment of gain values, and set temp
    updateSerialInterface();
    updateLCDInterface();
    updateTempSensor();

    // every second, udpate the current heat control, and print out current status

    // This checks for rollover with millis()
    if (millis() < lastPIDTime) {
    lastPIDTime = 0;
    }
    if ((millis() - lastPIDTime) > PID_UPDATE_INTERVAL) {
    lastPIDTime += PID_UPDATE_INTERVAL;
    heatPower = updatePID(targetTemp, getFreshTemp());
    setHeatPowerPercentage(heatPower);

    }
    updateHeater();
    }

    K-hőelem rész:

    #include"max6675.h"


    int thermoDO = 8;
    int thermoCS = 9;
    int thermoCLK = 10;

    float tc = 0.0;
    float latestReading = 0.0;
    const float offSet = 34.25; // MAX6675 + K thermocouple error

    MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);

    void updateTempSensor(){
    tc = thermocouple.readFahrenheit();
    }

    float getFreshTemp() {
    latestReading = tc - offSet;
    return latestReading;
    }

    float getLastTemp() {
    return latestReading;

    }

Új hozzászólás Aktív témák