user-img

Joel Stuart

+ Follow

System Upload

A UI project designed to simulate an uploading of a project.

System Upload
 
  • thumbnail-img
  • thumbnail-img
  • thumbnail-img
 

Hardware Components

  • CrowPanel 2.8"-ESP32 HMI 320x240 Display SPI TFT LCD Touch Scree

    X 1 fenxiang

Tools, APP Software Used etc.

  • Arduino IDE, Python 3, Serial Library (PySerial), RPi GPIO Libra

Story

The "Cyber-Terminal" code functions as a sophisticated state machine that manages both hardware communication and visual rendering to create an interactive, multi-page user interface. At its core, the code uses a global variable to track the current "state" or "app," ensuring that the Arduino only processes the logic and graphics for one specific screen at a time, which prevents data bottlenecks on your SPI bus and protects your USB-C adapter from power surges. The interaction is driven by the XPT2046 touch controller, which utilizes an interrupt pin (Pin 3) to signal the Arduino the moment a touch occurs; the code then captures these raw resistance values and uses the map() function to translate them into 320x240 screen coordinates. To keep the visuals smooth and "cool," the script employs conditional rendering—drawing static elements like headers only once—and uses the millis() timer combined with the modulo operator to generate high-speed animations, like the infinite progress bar, without stopping the rest of the code. By leveraging 16-bit RGB565 hex color codes and randomized data generation, the program simulates a high-tech terminal environment while maintaining a strict "debounce" delay to ensure every finger tap is registered as a single, intentional command rather than a chaotic flurry of inputs.

Code
  • #include "SPI.h" #include "Adafruit_GFX.h" #include "Adafruit_ILI9341.h" #include "XPT2046_Touchscreen.h" #define TFT_CS 10 #define TFT_DC A1 #define TFT_RST 8 #define TS_CS 4 #define TS_IRQ 3 Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST); XPT2046_Touchscreen ts(TS_CS, TS_IRQ); int currentPage = 0; const int maxPages = 3; int xStart, xEnd; bool isSwiping = false; void setup() { tft.begin(); ts.begin(); tft.setRotation(1); ts.setRotation(1); renderPage(); } void loop() { if (ts.touched()) { TS_Point p = ts.getPoint(); int x = map(p.x, 200, 3800, 0, 320); if (!isSwiping) { xStart = x; // Record where the finger first hit isSwiping = true; } xEnd = x; // Constantly update the end position } else { if (isSwiping) { handleSwipe(); // Finger lifted! Check the distance isSwiping = false; } } // Keep animations running for the current page runPageAnimations(); } void handleSwipe() { int distance = xEnd - xStart; int threshold = 50; // Minimum pixels to count as a swipe if (distance > threshold) { // Swipe Right (Go Back) currentPage--; if (currentPage < 0) currentPage = maxPages - 1; renderPage(); } else if (distance < -threshold) { // Swipe Left (Go Forward) currentPage++; if (currentPage >= maxPages) currentPage = 0; renderPage(); } } void renderPage() { tft.fillScreen(ILI9341_BLACK); tft.drawFastHLine(0, 230, 320, ILI9341_DARKGREY); // Page Indicators (Dots at the bottom) for(int i=0; i> PKT RECV: "); tft.print(random(10, 99)); } }

    https://github.com
    View
Topic
View All

System Upload

A UI project designed to simulate an uploading of a project.

15
 
1
0
0
These revenues will go back into supporting creators, contests, and the open source ecosystem, and more.

Share your project on social media to expand its influence! Get more people to support it.

  • Comments( 0 )
  • Like( 1 )
/1000
Upload a photo:
You can only upload 1 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP

You May Also Like

View All
Add to cart
Board Type : GerberFile :
Layer : Dimensions :
PCB Qty :
Different PCB Design
PCB Thickness : PCB Color :
Surface Finish : Castellated Hole :
Copper Weight : 1 oz Production Time :
Total: US $
As a sharing platform, our community will not bear responsibility for any issues with this design and parameters.

PCB Assembly

PCBA Qty: BomFile:
NO. OF UNIQUE PARTS: NO. of Components:
Country: Shipping Way:
Assembly Cost: US $
As a sharing platform, our community will not bear responsibility for any issues with this design and parameters.
Add to cart
3dPrintingFile : Size :
Unit : Volumn :
3D Printing Qty : Material :
Total: US $12.99
As a sharing platform, our community will not bear responsibility for any issues with this design and parameters.
Add to cart
Acrylic Type : AcrylicFile :
Dimensions: Engrave:
Acrylic Qty :
Acrylic Thickness:
Acrylic Color:
Total: US $12.99
As a sharing platform, our community will not bear responsibility for any issues with this design and parameters.
Add to cart
CNC Milling File : Size:
Unit: Volumn:
CNC Milling Qty : Material:
Type of Aluminum: Surface Finish:
Tolerance:
Surface Roughness:
Total: US $12.99
As a sharing platform, our community will not bear responsibility for any issues with this design and parameters.
Add to cart
Item Price Qty Subtotal Delete
Total: US $0.00
Certified Product | Guaranteed Purchase: Full techsupport