GY-63_MS5611/libraries/MAX31855_RT/examples/max31855_array/max31855_array.ino

76 lines
1.3 KiB
Arduino
Raw Normal View History

2021-01-29 06:31:58 -05:00
//
// FILE: max31855_array.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.1
// PURPOSE: demo of array of thermocouples
// DATE: 2020-08-26
// URL: https://github.com/RobTillaart/MAX31855_RT
//
// kudos to FabioBrondo for the idea.
//
#include "MAX31855.h"
// note: pins are slightly different than other examples!
const int dataPin = 7;
const int clockPin = 6;
2021-12-09 14:42:42 -05:00
MAX31855 A, B, C;
MAX31855 sensors[] =
2021-01-29 06:31:58 -05:00
{
2021-12-09 14:42:42 -05:00
A, B, C
2021-01-29 06:31:58 -05:00
};
2021-12-09 14:42:42 -05:00
2021-01-29 06:31:58 -05:00
const uint8_t sensorCount = sizeof(sensors) / sizeof(MAX31855);
2021-12-09 14:42:42 -05:00
2021-01-29 06:31:58 -05:00
void setup()
{
Serial.begin(115200);
Serial.print("Start max31855_array.ino : ");
Serial.println(MAX31855_VERSION);
Serial.println();
Serial.println(sensorCount);
for (int i = 0; i < sensorCount; i++)
{
2021-12-09 14:42:42 -05:00
sensors[i].begin(clockPin, 3 + i, dataPin); // three different select pins.
2021-01-29 06:31:58 -05:00
}
}
2021-12-09 14:42:42 -05:00
2021-01-29 06:31:58 -05:00
void loop()
{
Serial.print("\tTime:\t");
Serial.println(millis());
for (int i = 0; i < sensorCount; i++)
{
int status = sensors[i].read();
if (status != STATUS_OK)
{
Serial.print(i);
Serial.print("\tstatus:\t");
Serial.println(status);
}
else
{
float temp = sensors[i].getTemperature();
Serial.print(i);
Serial.print("\ttemp:\t");
Serial.println(temp);
}
}
Serial.println();
delay(1000);
}
2021-12-09 14:42:42 -05:00
2021-01-29 06:31:58 -05:00
// -- END OF FILE --
2021-12-09 14:42:42 -05:00