Skip to content

Commit 1fb6962

Browse files
committed
feat(wokwi-ili9341/lcd-uno): ILI9341 display test (uno)
1 parent a13d387 commit 1fb6962

File tree

8 files changed

+119
-0
lines changed

8 files changed

+119
-0
lines changed

.github/workflows/wokwi-test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ jobs:
3030
- name: dht22-stm32
3131
path: wokwi-dht22/dht22-stm32
3232
scenario: dht22.test.yaml
33+
- name: ili9341-uno
34+
path: wokwi-ili9341/lcd-uno
35+
scenario: ili9341.test.yaml
3336
- name: microsd-card-esp32
3437
path: wokwi-microsd-card/sd-esp32
3538
scenario: sd.test.yaml

wokwi-ili9341/lcd-uno/diagram.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"version": 1,
3+
"author": "Wokwi",
4+
"editor": "wokwi",
5+
"parts": [
6+
{
7+
"type": "wokwi-arduino-uno",
8+
"id": "uno",
9+
"top": 121.8,
10+
"left": -123.4,
11+
"rotate": 90,
12+
"attrs": {}
13+
},
14+
{
15+
"type": "wokwi-ili9341",
16+
"id": "lcd1",
17+
"top": 91.8,
18+
"left": 260.9,
19+
"rotate": 90,
20+
"attrs": { "width": "240", "height": "320" }
21+
}
22+
],
23+
"connections": [
24+
[ "uno:5V", "lcd1:VCC", "red", [ "h-28.7", "v-178.6", "h297.6", "v134.4" ] ],
25+
[ "uno:GND.1", "lcd1:GND", "black", [ "h81.6", "v9.9" ] ],
26+
[ "uno:13", "lcd1:SCK", "yellow", [ "h76.8", "v48.4", "h28.8" ] ],
27+
[ "uno:11", "lcd1:MOSI", "green", [ "h57.6", "v19.8", "h48" ] ],
28+
[ "uno:10", "lcd1:CS", "orange", [ "h38.4", "v-18.5" ] ],
29+
[ "uno:9", "lcd1:D/C", "blue", [ "h38.4", "v-8.8", "h67.2" ] ],
30+
[ "uno:8", "lcd1:RST", "purple", [ "h28.8", "v0.4", "h38.4", "v-28.8" ] ]
31+
],
32+
"dependencies": {}
33+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: 'Arduino Uno ILI9341 Test'
2+
version: 1
3+
author: 'Test Author'
4+
5+
steps:
6+
- delay: 100ms
7+
- wait-serial: 'ILI9341 Test!'
8+
- delay: 100ms
9+
- wait-serial: 'Display initialized'
10+
- delay: 100ms
11+
- wait-serial: 'Counter: 0'
12+
- take-screenshot:
13+
part-id: 'lcd1'
14+
compare-with: 'screenshots/count-0.png'
15+
- delay: 1000ms
16+
- wait-serial: 'Counter: 1'
17+
- take-screenshot:
18+
part-id: 'lcd1'
19+
compare-with: 'screenshots/count-1.png'

wokwi-ili9341/lcd-uno/platformio.ini

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[env:uno]
2+
platform = atmelavr
3+
board = uno
4+
framework = arduino
5+
lib_deps =
6+
adafruit/Adafruit ILI9341@^1.5.12
7+
adafruit/Adafruit GFX Library@^1.11.5
8+
adafruit/Adafruit BusIO@^1.14.1
1.85 KB
Loading
1.83 KB
Loading

wokwi-ili9341/lcd-uno/src/main.cpp

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#include <SPI.h>
2+
#include <Adafruit_GFX.h>
3+
#include <Adafruit_ILI9341.h>
4+
5+
#define TFT_CS 10
6+
#define TFT_DC 9
7+
#define TFT_RST 8
8+
9+
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);
10+
11+
void setup() {
12+
Serial.begin(115200);
13+
Serial.println("ILI9341 Test!");
14+
15+
tft.begin();
16+
tft.setRotation(1); // Landscape mode
17+
tft.fillScreen(ILI9341_BLACK);
18+
19+
// Draw some text
20+
tft.setCursor(0, 0);
21+
tft.setTextColor(ILI9341_WHITE);
22+
tft.setTextSize(2);
23+
tft.println("ILI9341 Test");
24+
tft.println("Hello World!");
25+
26+
// Draw a rectangle
27+
tft.fillRect(50, 100, 140, 40, ILI9341_RED);
28+
tft.setCursor(60, 110);
29+
tft.setTextColor(ILI9341_WHITE);
30+
tft.setTextSize(2);
31+
tft.println("Button");
32+
33+
Serial.println("Display initialized");
34+
}
35+
36+
void loop() {
37+
static int counter = 0;
38+
39+
// Update counter display
40+
tft.fillRect(50, 150, 140, 40, ILI9341_BLUE);
41+
tft.setCursor(60, 160);
42+
tft.setTextColor(ILI9341_WHITE);
43+
tft.setTextSize(2);
44+
tft.print("Count: ");
45+
tft.println(counter);
46+
47+
Serial.print("Counter: ");
48+
Serial.println(counter);
49+
50+
counter++;
51+
delay(1000);
52+
}

wokwi-ili9341/lcd-uno/wokwi.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[wokwi]
2+
version = 1
3+
firmware = '.pio/build/uno/firmware.elf'
4+
elf = '.pio/build/uno/firmware.elf'

0 commit comments

Comments
 (0)