Your Adafruit ESP32-S3 Reverse TFT Feather ships from the factory with a I2C and graphics test demo. You can download a UF2 of the demo from the Factory Reset page. The UF2 does not give you access to the source code to allow you to see what is going on in the code and potentially edit it. This page provides the factory demo source code, including walking you through what libraries to install to get it going.
Arduino Library Installation
You can install the necessary libraries from the Library Manager. To open, click Sketch > Include Library > Manage Libraries...
Next, you'll search for the following libraries, and install them and any necessary dependencies.
Search for MAX17048 and install the Adafruit MAX1704X Library.
When asked to install dependencies, click Install all.
Search for NeoPixel and install the Adafruit NeoPixel library.
Search for TestBed and install the Adafruit TestBed library.
When asked to install dependencies, click Install all.
Search for BME280 and install the Adafruit BME280 Library.
When asked to install dependencies, click Install all.
Search for ST7789 and install the Adafruit ST7735 and ST7789 Library.
When asked to install dependencies, click Install all.
Factory Demo Example Code
Now, you'll want to upload the following sketch onto your ESP32-S3 Reverse TFT Feather.
// SPDX-FileCopyrightText: 2022 Limor Fried for Adafruit Industries // // SPDX-License-Identifier: MIT #include <Arduino.h> #include "Adafruit_MAX1704X.h" #include <Adafruit_NeoPixel.h> #include "Adafruit_TestBed.h" #include <Adafruit_BME280.h> #include <Adafruit_ST7789.h> #include <Fonts/FreeSans12pt7b.h> Adafruit_BME280 bme; // I2C bool bmefound = false; extern Adafruit_TestBed TB; Adafruit_MAX17048 lipo; Adafruit_ST7789 display = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST); GFXcanvas16 canvas(240, 135); void setup() { Serial.begin(115200); //while (! Serial) delay(10); delay(100); TB.neopixelPin = PIN_NEOPIXEL; TB.neopixelNum = 1; TB.begin(); TB.setColor(WHITE); display.init(135, 240); // Init ST7789 240x135 display.setRotation(3); canvas.setFont(&FreeSans12pt7b); canvas.setTextColor(ST77XX_WHITE); if (!lipo.begin()) { Serial.println(F("Couldnt find Adafruit MAX17048?\nMake sure a battery is plugged in!")); while (1) delay(10); } Serial.print(F("Found MAX17048")); Serial.print(F(" with Chip ID: 0x")); Serial.println(lipo.getChipID(), HEX); if (TB.scanI2CBus(0x77)) { Serial.println("BME280 address"); unsigned status = bme.begin(); if (!status) { Serial.println("Could not find a valid BME280 sensor, check wiring, address, sensor ID!"); Serial.print("SensorID was: 0x"); Serial.println(bme.sensorID(),16); Serial.print(" ID of 0xFF probably means a bad address, a BMP 180 or BMP 085\n"); Serial.print(" ID of 0x56-0x58 represents a BMP 280,\n"); Serial.print(" ID of 0x60 represents a BME 280.\n"); Serial.print(" ID of 0x61 represents a BME 680.\n"); return; } Serial.println("BME280 found OK"); bmefound = true; } pinMode(0, INPUT_PULLUP); pinMode(1, INPUT_PULLDOWN); pinMode(2, INPUT_PULLDOWN); } int j = 0; void loop() { bool valid_i2c[128]; Serial.println("**********************"); if (j == 0) { Serial.print("I2C scan: "); for (int i=0; i< 128; i++) { if (TB.scanI2CBus(i, 0)) { Serial.print("0x"); Serial.print(i, HEX); Serial.print(", "); valid_i2c[i] = true; } else { valid_i2c[i] = false; } } } if (j % 2 == 0) { canvas.fillScreen(ST77XX_BLACK); canvas.setCursor(0, 17); canvas.setTextColor(ST77XX_RED); canvas.println("Adafruit Feather"); canvas.setTextColor(ST77XX_YELLOW); canvas.println("ESP32-S3 TFT Demo"); canvas.setTextColor(ST77XX_GREEN); canvas.print("Battery: "); canvas.setTextColor(ST77XX_WHITE); canvas.print(lipo.cellVoltage(), 1); canvas.print(" V / "); canvas.print(lipo.cellPercent(), 0); canvas.println("%"); canvas.setTextColor(ST77XX_BLUE); canvas.print("I2C: "); canvas.setTextColor(ST77XX_WHITE); for (uint8_t a=0x01; a<=0x7F; a++) { if (valid_i2c[a]) { canvas.print("0x"); canvas.print(a, HEX); canvas.print(", "); } } canvas.println(""); canvas.print("Buttons: "); Serial.println(digitalRead(0)); Serial.println(digitalRead(1)); Serial.println(digitalRead(2)); if (!digitalRead(0)) { canvas.print("D0, "); } if (digitalRead(1)) { canvas.print("D1, "); } if (digitalRead(2)) { canvas.print("D2, "); } display.drawRGBBitmap(0, 0, canvas.getBuffer(), 240, 135); pinMode(TFT_BACKLITE, OUTPUT); digitalWrite(TFT_BACKLITE, HIGH); } TB.setColor(TB.Wheel(j++)); delay(10); return; }
Open the Serial Monitor to see the connected I2C addresses and the logic levels of the three buttons printed out.
Now your Feather TFT is back to the state in which it shipped! And, loading it from code allows you to learn more, or change it to do something different.
Text editor powered by tinymce.