// STM32 Nucleo-C031C6 SPI LCD Example
// Simulation: https://wokwi.com/projects/365549388158011393
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#define TFT_DC 2
#define TFT_CS 3
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
uint32_t loopCounter;
unsigned long previousMillis = 0;
unsigned long previousMillis1 = 0;
unsigned long previousMillis2 = 0;
const long interval = 1000; // (2)
const long interval1 = 1001; // (2)
const long interval2 = 1002; // (2)
const uint64_t u64 = 0 - 1;
void setup() {
Serial.begin(115200);
//Serial.println(u64);
delay(1000);
Serial.println(micros());
//Serial.println("Hello, WOKWI");
tft.begin();
tft.setCursor(20, 120);
tft.setTextColor(ILI9341_RED);
tft.setTextSize(3);
tft.println("Hello STM2");
tft.setCursor(24, 160);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(2);
tft.println("I can do SPI :-)");
delay(500);
tft.setCursor(20, 120);
tft.setTextColor(ILI9341_BLACK);
tft.setTextSize(3);
tft.println("Hello STM2");
delay(5000);
}
void loop() {
loopCounter++;
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
previousMillis = currentMillis;
Serial.print("loopCounter = ");
Serial.println(loopCounter);
Serial.print("currentMillis = ");
Serial.println(currentMillis);
}
if (currentMillis - previousMillis1 >= interval1) {
previousMillis1 = currentMillis;
Serial.print("loopCounter = ");
Serial.println(loopCounter);
Serial.print("currentMillis = ");
Serial.println(currentMillis);
}
if (currentMillis - previousMillis2 >= interval2) {
previousMillis2 = currentMillis;
Serial.print("loopCounter = ");
Serial.println(loopCounter);
Serial.print("currentMillis = ");
Serial.println(currentMillis);
Serial.println();
}
delay(3);
}