Advertisement
learnelectronics

Max6675 Thermocouple Amplifier with OLED Demo

Jul 18th, 2018
890
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.18 KB | None | 0 0
  1. /*
  2.   Max6675 Thermocouple Amplifier with OLED Demo
  3.  
  4.   learnelectronics
  5.   17 JUL 2018
  6.   www.youtube.com/c/learnelectronics
  7.  
  8.   MAX6675 Library Created by Ryan McLaughlin <[email protected]>
  9.   Download the library here: https://github.com/mcleng/MAX6675-Library
  10.  
  11.  
  12. */
  13.  
  14. #include <MAX6675.h>                                        //Library for 6675 IC
  15. #include <Wire.h>                                           //I2C Library
  16. #include <Adafruit_SSD1306.h>                               //Library for OLED with SSD1306 IC
  17.  
  18. #define OLED_RESET 4                                        //OLED reset on digital 4
  19.  
  20.  
  21.  
  22. float temperature = 0.0;                                    // Temperature output variable
  23.  
  24.  
  25. /
  26. MAX6675 temp(10,12,13,2);                                   // Initialize the MAX6675 Library for our chip
  27.  
  28. Adafruit_SSD1306 display(OLED_RESET);                       // Initialize the SSD1306 Library for our chip
  29.  
  30.  
  31.  
  32. void setup() {
  33.   Serial.begin(9600);                                       //Serial comms @ 9600
  34.   display.begin(SSD1306_SWITCHCAPVCC, 0x3C);                //Start up the oled at hex addy 0x3c
  35.   display.display();                                        //show logo
  36.   delay(2000);                                              //enjoy logo
  37.   display.clearDisplay();                                   //goodbye logo
  38. }
  39.  
  40. void loop() {
  41.    
  42.     temperature = temp.read_temp();                           // Read the temp from the MAX6675
  43.  
  44.     display.clearDisplay();                                   //clear display
  45.     display.setTextSize(2);                                   //text size 2
  46.   display.setTextColor(WHITE);                              //text color white
  47.   display.setCursor(15,25);                                 //kinda middle-ish
  48.  
  49.   display.print(temperature);                               //send temp reading to display buffer
  50.   display.print(" F");                                      //send units to display buffer
  51.   display.display();                                        //show me the buffer
  52.   delay(2000);                                              //whew! that was hard. lets take a breath
  53.        
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement