I'm building a DIY PCB Hotplate and discovered what I believe might be a bug in these libraries.
Here's my code:
Code: Select all
// this example is public domain. enjoy! https://learn.adafruit.com/thermocouple/
#include "max6675.h"
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7735.h> // Hardware-specific library for ST7735
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
#include <SPI.h>
#include <WiFi.h>
int thermoDO = 4;
int thermoCS = 21;
int thermoCLK = 19;
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
#define TFT_CS 14
#define TFT_RST 15 // Or set to -1 and connect to Arduino RESET pin
#define TFT_DC 32
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
void setup() {
//tft.initR(INITR_144GREENTAB); // Init ST7735R chip, green tab
//Serial.println(F("TFT Initialized"));
Serial.begin(115200);
Serial.println("MAX6675 test");
// wait for MAX chip to stabilize
delay(500);
}
void loop() {
// basic readout test, just print the current temp
Serial.print("C = ");
Serial.println(thermocouple.readCelsius());
Serial.print("F = ");
Serial.println(thermocouple.readFahrenheit());
// For the MAX6675 to update, you must delay AT LEAST 250ms between reads!
delay(1000);
}
In an attempt to debug, I took the working MAX6675 sketch, and line by line, added code for the ST7735.
It was the initialization that broke the MAX chip:
Code: Select all
tft.initR(INITR_144GREENTAB)