So currently i have 18b20s connected to a single bus line. Im able to read the addresses and i have them saved. My issue that my goal is to send the temp readings in serial for node red to see. I want to make sure that the sensors will always align to the same output. Im not sure how to put the addresses in the code to make it work. I currently have the code setup like below. Im able to read my temps fine but want to be sure it wont change on me for some reason. And yes their is other code in it for a pressure sensor and thermocouple which im not worried about since i already got that part working the way i want.
'''
#include <Adafruit_MAX31855.h>
#include <SPI.h>
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is plugged into port 8 on the Arduino
#define ONE_WIRE_BUS 8
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
// arrays to hold device addresses
uint8_t sensorA[8], sensorB[8], sensorC[8], sensorD[8], sensorE[8], sensorF[8], sensorG[8], sensorH[8];
int thermoDO = 5;
int thermoCS = 4;
int thermoCLK = 3;
Adafruit_MAX31855 thermocouple(thermoCLK, thermoCS, thermoDO);
void setup(void)
{
// start serial port
Serial.begin(9600);
delay(500);
// Start up the library
sensors.begin();
}
void loop(void)
{
// call sensors.requestTemperatures() to issue a global temperature
// request to all devices on the bus
sensors.requestTemperatures();
Serial.print("A "); //Send NEW Packet to computer
Serial.print(sensors.getTempFByIndex(0)); //Send SensorA data to computer
Serial.println();
delay(500);
{
Serial.print("B "); // Seperater...
Serial.print(sensors.getTempFByIndex(1)); //Send SensorB data to computer
Serial.println();
delay(500);
{
Serial.print("C "); //Send NEW Packet to computer
Serial.print(sensors.getTempFByIndex(2)); //Send SensorA data to computer
Serial.println();
delay(500);
{
Serial.print("D "); //Send NEW Packet to computer
Serial.print(sensors.getTempFByIndex(3)); //Send SensorA data to computer
Serial.println();
delay(500);
{
Serial.print("E "); //Send NEW Packet to computer
Serial.print(sensors.getTempFByIndex(4)); //Send SensorA data to computer
Serial.println();
delay(500);
{
Serial.print("F "); //Send NEW Packet to computer
Serial.print(sensors.getTempFByIndex(5)); //Send SensorA data to computer
Serial.println();
delay(500);
{
Serial.print("G "); //Send NEW Packet to computer
Serial.print(sensors.getTempFByIndex(6)); //Send SensorA data to computer
Serial.println();
delay(500);
{
Serial.print("H "); //Send NEW Packet to computer
Serial.print(sensors.getTempFByIndex(7)); //Send SensorA data to computer
Serial.println();
delay(500);
}
}
}
}
}
}
float sensorVoltage = analogRead(0); // read the sensor voltage
int psi = ((sensorVoltage-95)/204)*50;
Serial.print("PSI ");
Serial.println (psi);
delay (1000);
double f = thermocouple.readFarenheit();
{
Serial.print("FLUE ");
Serial.println(thermocouple.readFarenheit());
delay(2000);
}
}
}
'''