good morning all
trying to add a little 240x240 st7789 oled display to my project
Ive been using a standard 16,2 LCD but i want to get a bit more info on the screen so moving to the oled
I've got it working up to a point right now I'm just duplicating code for the oled that the lcd displays and all was working well until I started trying to display text to the screen while it is checking for my SD card.
My SD card does not have a CS pin but it is sharing clk and MOSI with the SD card.
so the question is do i need to wait till I'm done reading the SD card to start displaying to the oled again?
here is the code snippet I am able to display to the oled until line 6 it will not display the lines past that on the oled however the lcd and everything else continues to work just fine
tft.println(" "); // line 4
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Initializing...");
lcd.setCursor(0,1);
lcd.print("Outputs");
tft.println("Outputs"); // line 5
servo1.attach(8); //assigns pin 8 to control servo 1
servo1.write(0); //its usually open so this closes it
tft.println("Servo Initialized"); // line 6
delay(3000);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Initializing");
lcd.setCursor(1,1);
lcd.print("SD card...");
pinMode(SD_CS, OUTPUT); //sets the SD cards CS pin to output
delay(3000);
// next we see if the card is present and can be initialized:
if (!SD.begin(SD_CS)) //it did not see an SD card
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Card Failure or");
lcd.setCursor(1,1);
lcd.print("not present");
tft.println("SD CARD FAILED"); // line 7 if failed
delay(4000);
// don't do anything else you need to install a SD card
while (1);
}
else // it did see the SD card
{
tft.println("SD card Intialized"); // line 7 if passed
lcd.clear();
lcd.setCursor(0,0);
lcd.print("SD card found");
lcd.setCursor(0,1);
lcd.print("Checking config");
tft.println("Checking for Config"); // line 8
delay(2000);
// try to open the config file
if (SD.exists("acconfig.txt")) // the file is available
{
read_sd(); // runs the SD card read function
delay(1500);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Temp set to");
lcd.setCursor(0,1);
lcd.print(ITT);
lcd.setCursor(4,1);
lcd.print("F");
tft.println("Config Found"); // line 9
tft.println("loading");
dotdotdot = 0;
while (dotdotdot < 4)
{
tft.print("."); // adds to line 9
dotdotdot++;
}
tft.println("Config Loaded"); // line 10
delay(2000);
}
else // the file is not available
{
lcd.clear();
lcd.setCursor(0,0);
lcd.print(" No Config ");
lcd.setCursor(0,1);
lcd.print(" Running Setup ");
delay(1500);
virgin(); // runs the setup fucntion
}