Hi,
I am working on a project using multiple MAX31865 breakout boards (SPI).
I found a code example (see below), which works, but I would like to adapt this example to my project.
It is a little difficult as I do not understand some of the syntax.
I suspect it is probably efficient code, but as a beginner I cannot follow it.
-
the line...... "float operatMax31865_1(void) {.....
this looks and works like a function, but why does it include data type 'float''?
..and why does it have ..(void).. Not seen this before.
Functions I have seen before use syntax "void functionName() { -
serial.print('/ ');
this results in display of "12064" Don't know what this figure represents
It disappears if I comment-out.
Never seen this syntax before - what does it mean/do??
Just curious...and hope to learn something new
Help appreciated.
#include "SPI.h"
#include <Adafruit_MAX31865.h> // Adafruit's Header file
// Use software SPI: CS, DI, DO, CLK
// Adafruit_MAX31865 max = Adafruit_MAX31865(8, 10, 11, 9); // ss, mosi, miso, sck
// use hardware SPI, Write your CS pin
Adafruit_MAX31865 max_1 = Adafruit_MAX31865(8);
Adafruit_MAX31865 max_2 = Adafruit_MAX31865(14);
Adafruit_MAX31865 max_3 = Adafruit_MAX31865(31);
Adafruit_MAX31865 max_4 = Adafruit_MAX31865(35);
#define RREF 4300.0 // 4.3Kohm
#define RNOMINAL 1000.0 // PT1000
float operatMax31865_1(void) {
float temperature_1 = max_1.temperature(RNOMINAL, RREF);
return temperature_1;
}
float operatMax31865_2(void) {
float temperature_2 = max_2.temperature(RNOMINAL, RREF);
return temperature_2;
}
float operatMax31865_3(void) {
float temperature_3 = max_3.temperature(RNOMINAL, RREF);
return temperature_3;
}
float operatMax31865_4(void) {
float temperature_4 = max_4.temperature(RNOMINAL, RREF);
return temperature_4;
}
void setup() {
// put your setup code here, to run once:
max_1.begin(MAX31865_3WIRE); // set to 2WIRE or 4WIRE as necessary
max_2.begin(MAX31865_3WIRE); // set to 2WIRE or 4WIRE as necessary
max_3.begin(MAX31865_3WIRE); // set to 2WIRE or 4WIRE as necessary
max_4.begin(MAX31865_3WIRE); // set to 2WIRE or 4WIRE as necessary
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.print("PT1000_1: "); Serial.print(operatMax31865_1()); Serial.print('/ ');
Serial.print("PT1000_2: "); Serial.print(operatMax31865_2()); Serial.print('/ ');
Serial.print("PT1000_3: "); Serial.print(operatMax31865_3()); Serial.print('/ ');
Serial.print("PT1000_4: "); Serial.println(operatMax31865_4());
}
Can someone please explain the following