-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLittleFSTest.cpp
More file actions
51 lines (41 loc) · 1.18 KB
/
Copy pathLittleFSTest.cpp
File metadata and controls
51 lines (41 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*********
Directly copied from https://RandomNerdTutorials.com/esp8266-nodemcu-vs-code-platformio-littlefs/
Original author Rui Santos
*********/
#include <Arduino.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include "LittleFS.h"
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
int ENABLE_PIN = 2;
bool found = false;
int incomingByte = 0;
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
void setup() {
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
display.setTextSize(1);
display.setCursor(0, 0);
display.setTextColor(WHITE);
if(!LittleFS.begin()){
display.println("An Error has occurred while mounting LittleFS");
display.display();
return;
}
File file = LittleFS.open("/game_index.html", "r");
if(!file){
display.setCursor(0, 0);
display.println("Failed to open file for reading");
display.display();
return;
}
display.setCursor(0, 0);
while(file.available()){
display.write(file.read());
}
display.display();
}
void loop() {
}