Hi,
I'm using an oled display with an arduino and I'm having some reset problems. Any help is great!
Thank you,
Jaden
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <max6675.h>
Adafruit_SSD1306 display = Adafruit_SSD1306();
int thermoDO = 7;
int thermoCS = 5;
int thermoCLK = 6;
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
int val;
int encoder0PinA = 3;
int encoder0PinB = 4;
int encoder0Pos = 0;
int encoder0PinALast = LOW;
int n = LOW;
void setup() {
pinMode (9, OUTPUT);
pinMode (10, OUTPUT);
pinMode (encoder0PinA, INPUT);
pinMode (encoder0PinB, INPUT);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
delay(500);
}
void loop() {
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 0);
display.print("F = ");
display.println(thermocouple.readFahrenheit());
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0, 1);
display.println("F = ");
display.println(encoder0Pos);
n = digitalRead(encoder0PinA);
if ((encoder0PinALast == LOW) && (n == HIGH)) {
if (digitalRead(encoder0PinB) == LOW) {
encoder0Pos--;
} else {
encoder0Pos++;
if (thermocouple.readFahrenheit() > encoder0Pos) {
digitalWrite(10, LOW);// set pin 10 LOW
} else {
digitalWrite(10, HIGH);// set pin 10 HIGH
if (thermocouple.readFahrenheit() > encoder0Pos) {
digitalWrite(9, HIGH);
delay(5000);
digitalWrite(9, LOW);
} else {
digitalWrite(9, LOW);
}
delay(1000);
}
}
}
}