#include "SPI.h"
#include <Adafruit_ILI9341.h>
#include <Adafruit_GFX.h>
// TFT LCD Display
#define PIN_TFT_CS 17
#define PIN_TFT_DC 7
#define PIN_TFT_RST 6
Adafruit_ILI9341 tft = Adafruit_ILI9341(PIN_TFT_CS, PIN_TFT_DC, PIN_TFT_RST);
// Adafruit_ILI9341(int8_t _CS, int8_t _DC, int8_t _MOSI, int8_t _SCLK,
// int8_t _RST = -1, int8_t _MISO = -1);
// Push button
#define PIN_SW1 28
#define PIN_SW2 27
#define PIN_SW3 26
void setup() {
// put your setup code here, to run once:
Serial1.begin(115200);
Serial1.println("Hello, Raspberry Pi Pico!");
pinMode(PIN_SW1, INPUT_PULLUP);
pinMode(PIN_SW2, INPUT_PULLUP);
pinMode(PIN_SW3, INPUT_PULLUP);
tft.begin();
Serial1.println(tft.readcommand8(ILI9341_RDSELFDIAG));
tft.setCursor(0, 0);
tft.setTextColor(ILI9341_RED);
tft.setTextSize(3);
tft.println("Hello, TFT!");
tft.setCursor(20, 160);
tft.setTextColor(ILI9341_GREEN);
tft.setTextSize(2);
tft.println("I can has colors?");
}
void loop() {
// put your main code here, to run repeatedly:
static unsigned long lastSwitchCheck = 0;
if(millis() > lastSwitchCheck + 1000) {
Serial1.println(String(digitalRead(PIN_SW1)) + " " +
String(digitalRead(PIN_SW2)) + " " +
String(digitalRead(PIN_SW3)));
lastSwitchCheck = millis();
}
delay(1); // this speeds up the simulation
}