Code for Max6675
#include "angled bracket"SPI.h"angled bracket"
#include "max6675.h"
const int thermoDO = 12;
const int thermoCS = 10;
const int thermoCLK = 13;
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
void setup() {
Serial.begin(9600);
Serial.println("MAX6675 test");
delay(500);
}
void loop() {
// Read temperature from the thermocouple
double tempC = thermocouple.readCelsius();
double tempF = (tempC * 9.0 / 5.0) + 32.0; // Convert Celsius to Fahrenheit
// Check for errors
if (tempC == -1.0) {
Serial.println("Error reading thermocouple.");
} else {
Serial.print("Temperature: ");
Serial.print(tempC);
Serial.print(" °C ");
Serial.print(tempF);
Serial.println(" °F");
}
delay(1000); // Wait for a second before reading again
}
Copy all the above codes to Sketch. Remove the angled bracket by greater a and less sign. You can also use chatgpt to generate codes.
robu.in @robuelectronics-ts5pd
#Robu electronics
#labview #labview_master
29 июл 2024