So my project is to send temperature value from MAX31865 to my computer via ETHERNET. I won't get into the details of the program of my computer's side. Instead, I've extracted the important bits of my code for ease of reproducibility. Here's my full code below.
#include <Adafruit_MAX31865.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
// An EthernetUDP instance to let us send and receive packets over UDP
EthernetUDP Udp;
bool ethstats = false;
uint8_t packetPos = 0;
bool udp_init(){
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
IPAddress ip(192, 168, 2, 90);
uint16_t localPort = 5000; // local port to listen on
// start the Ethernet
Ethernet.begin(mac, ip);
bool result = Ethernet.hardwareStatus() == EthernetNoHardware || Ethernet.linkStatus() == LinkOFF;
result = !result;
// start UDP
if(result) Udp.begin(localPort);
return result;
}
void setup() {
// put your setup code here, to run once:
Serial.begin(19200);
udp_init();
}
void loop() {
// put your main code here, to run repeatedly:
Adafruit_MAX31865 thermo = Adafruit_MAX31865(10, 11, 12, 13);
thermo.begin(MAX31865_2WIRE); // set to 2WIRE or 4WIRE as necessary
float temperature = thermo.temperature(1000, 4300);
Serial.print("Temperature = "); Serial.println(temperature);
delay(100);
}
Now let's take a look at this specific bit:
void setup() {
// put your setup code here, to run once:
Serial.begin(19200);
udp_init();
}
With this function being called, MAX31865 outputs -242 every time.
Whereas when I disable it, with the following code:
void setup() {
// put your setup code here, to run once:
Serial.begin(19200);
// udp_init();
}
MAX31865 worked well and outputted somewhere around 23 (the room temperature). Any solutions on how to overcome this? Thanks in advance.