0

I have a thermocouple k. I want this thermocouple to select the first value OF TEMPERATURE that it read and assign it to a variable in an Arduino program.

How should I do that?

  • 1
    Which thermocouple? Which library does it need/do you use? What is your current sketch? – Michel Keijzers Nov 1 '18 at 14:20
  • thermocouple K. Library max6675. my sketch is – JEANNE Nov 1 '18 at 14:24
  • my sketch is too long to be put in the comment space. – JEANNE Nov 1 '18 at 14:27
  • 1
    Than edit your question (that's also where your first comment should be). – Michel Keijzers Nov 1 '18 at 14:28
0

To read the temperature:

thermocouple.readFarenheit(); // or readCelcius();

To assign it to a variable

void loop()
{
    double temp = thermocouple.readFarenheit(); // or readCelcius();
    ...
}

You also can store it in a global variable, the above is for a local variable. Global variable:

double temp;

void loop()
{
    temp = thermocouple.readFarenheit(); // or readCelcius();
    ...
}

Here you can find a complete example.

  • If the solution is correct, please press the upvote button and the accept button. – Michel Keijzers Nov 1 '18 at 15:30
  • Or store the temperatures in an array, so you can access them across time, say one reading every 30 seconds or something. Size the array to match the time duration to be used. – CrossRoads Nov 1 '18 at 15:45
  • 1
    Or use a ringbuffer to store the latest x temperature measurements.. – Michel Keijzers Nov 1 '18 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.