#include "max6675.h" // max6675.h file is part of the library that you should download from Robojax.com
int soPin = 4;// SO=Serial Out
int csPin = 5;// CS = chip select CS pin
int sckPin = 6;// SCK = Serial Clock pin
MAX6675 Module(sckPin, csPin, soPin);
#include "HX711.h"
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET LED_BUILTIN
float analog_pot=0;
#define DOUT 2
#define CLK 3
HX711 scale;
//float calibration_factor =5.1714924102396; // 1 Psi is 5.1714924102396 cm Hg
float calibration_factor =51714; // maby
Adafruit_SSD1306 display(OLED_RESET);
#if (SSD1306_LCDHEIGHT != 32)
#error("Height incorrect, please fix Adafruit_SSD1306.h!");
#endif
void setup() {
Serial.begin(9600);
// display.println("MAX6675");
scale.begin(2, 3);
scale.set_scale();
scale.tare(); //Reset the scale to 0
long zero_factor = scale.read_average(); //Get a baseline reading
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3D (for the 128x64)
// init done
display.display();
delay(200);
// Clear the buffer.
display.clearDisplay();
// put your setup code here, to run once:
}
void loop() {
scale.set_scale(calibration_factor); //Adjust to this calibration factor
display.clearDisplay();
display.setTextSize(1.9);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.println("dama = ");
display.setCursor(15,20);
display.println("fashar");
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(70,20);
//display.print 4(scale.get_units()*0.0000, 2);
display.print(scale.get_units()*0.135, 2);
display.println(" Psi");
display.println();
display.print(scale.get_units(), 2);
display.println(" £");
display.setTextColor(BLACK, WHITE); // 'inverted' text
display.display();
delay(10);
// put your main code here, to run repeatedly:
}