generated from jmgiacalone/esp32-template
materialize mins added.
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
<!--Let browser know website is optimized for mobile-->
|
<!--Let browser know website is optimized for mobile-->
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
|
<link type="text/css" rel="stylesheet" href="css/materialize.min.css" media="screen,projection" />
|
||||||
<link rel="stylesheet" type="text/css" href="css/style.css" />
|
<link rel="stylesheet" type="text/css" href="css/style.css" />
|
||||||
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
||||||
</head>
|
</head>
|
||||||
@@ -31,6 +32,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script type="text/javascript" src="js/materialize.min.js"></script>
|
||||||
<script type="text/javascript" src="js/scripts.js"></script>
|
<script type="text/javascript" src="js/scripts.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
30
src/main.cpp
30
src/main.cpp
@@ -21,6 +21,8 @@
|
|||||||
#include <Preferences.h>
|
#include <Preferences.h>
|
||||||
Preferences settings;
|
Preferences settings;
|
||||||
|
|
||||||
|
#define I2C_SDA 5//13
|
||||||
|
#define I2C_SCL 4//15
|
||||||
#define LED_PIN 5
|
#define LED_PIN 5
|
||||||
|
|
||||||
//*****
|
//*****
|
||||||
@@ -29,11 +31,12 @@ Preferences settings;
|
|||||||
#define SCREEN_WIDTH 128
|
#define SCREEN_WIDTH 128
|
||||||
#define SCREEN_HEIGHT 64
|
#define SCREEN_HEIGHT 64
|
||||||
|
|
||||||
#define SCREEN_REFRESH 5000
|
#define SCREEN_REFRESH 1000
|
||||||
|
|
||||||
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
|
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
|
||||||
unsigned long lastScreenRefresh = 0;
|
unsigned long lastScreenRefresh = 0;
|
||||||
|
|
||||||
|
//MAX6675(int8_t SCLK, int8_t CS, int8_t MISO);
|
||||||
MAX6675 tc(12, 13, 15);
|
MAX6675 tc(12, 13, 15);
|
||||||
|
|
||||||
//*********************************************************
|
//*********************************************************
|
||||||
@@ -85,17 +88,22 @@ String getLEDState();
|
|||||||
void setup() {
|
void setup() {
|
||||||
pinMode(LED_PIN, OUTPUT);
|
pinMode(LED_PIN, OUTPUT);
|
||||||
|
|
||||||
Wire.begin(5, 4);
|
|
||||||
|
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
delay(2000);
|
|
||||||
// while (!Serial)
|
|
||||||
// delay(10); // will pause Zero, Leonardo, etc until serial console opens
|
|
||||||
|
|
||||||
display.clearDisplay();
|
Wire.begin(I2C_SDA, I2C_SCL);
|
||||||
display.setTextColor(WHITE);
|
|
||||||
display.setTextSize(1);
|
digitalWrite(LED_PIN, HIGH);
|
||||||
display.setCursor(0, 26);
|
delay(2000);
|
||||||
|
digitalWrite(LED_PIN, LOW);
|
||||||
|
|
||||||
|
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C, false, false)) {
|
||||||
|
Serial.println(F("SSD1306 allocation failed"));
|
||||||
|
}else{
|
||||||
|
display.clearDisplay();
|
||||||
|
display.setTextColor(WHITE);
|
||||||
|
display.setTextSize(1);
|
||||||
|
display.setCursor(0, 26);
|
||||||
|
}
|
||||||
|
|
||||||
//*****************************************
|
//*****************************************
|
||||||
|
|
||||||
@@ -280,7 +288,7 @@ void loop() {
|
|||||||
digitalWrite(LED_PIN,LOW);
|
digitalWrite(LED_PIN,LOW);
|
||||||
delay(500);
|
delay(500);
|
||||||
if ((millis() - lastScreenRefresh) > SCREEN_REFRESH) {
|
if ((millis() - lastScreenRefresh) > SCREEN_REFRESH) {
|
||||||
Serial.printf("T:%.2f,", temperature);
|
Serial.printf("T:%.2f\n", temperature);
|
||||||
|
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
display.setTextSize(3);
|
display.setTextSize(3);
|
||||||
|
|||||||
Reference in New Issue
Block a user