#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#define TFT_DC 9
#define TFT_CS 10
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
void setup() {
tft.begin();
tft.setRotation(180); // Landscape orientation
tft.fillScreen(ILI9341_BLACK);
tampilkanTeks();
tampilkanHiasanBintang();
}
void tampilkanTeks() {
tft.setTextSize(2);
tft.setTextColor(ILI9341_PINK);
tft.setCursor(40, 60);
tft.print("Hello, Wokwi!");
tft.setTextSize(2);
tft.setTextColor(ILI9341_WHITE, ILI9341_BLUE);
tft.setCursor(40, 90);
tft.print("Arduino & LCD!");
}
void tampilkanHiasanBintang() {
int x_center = 120;
int y_center = 100;
// Menggambar bintang di sekitar teks
for (int i = 0; i < 360; i += 30) {
float angle = radians(i);
int x = x_center + 100 * cos(angle); // Radius 70 untuk lingkaran
int y = y_center + 80 * sin(angle); // Radius 50 untuk elips
gambarBintang(x, y, 5, ILI9341_CYAN);
}
}
void gambarBintang(int x, int y, int radius, uint16_t color) {
// Gambar bintang sederhana dengan titik di sekitar lingkaran
for (int i = 0; i < 5; i++) {
float angle = radians(i * 72);
int x1 = x + radius * cos(angle);
int y1 = y + radius * sin(angle);
float angle2 = radians((i * 72) + 36);
int x2 = x + (radius / 2) * cos(angle2);
int y2 = y + (radius / 2) * sin(angle2);
tft.drawLine(x, y, x1, y1, color);
tft.drawLine(x1, y1, x2, y2, color);
}
}
void loop() {
// Tidak ada kode dalam loop untuk contoh ini
}