#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.fillScreen(ILI9341_BLACK);
tft.fillScreen(ILI9341_WHITE);
tft.setRotation(1);
//tft.setTextColor(ILI9341_GREEN);
tft.setTextColor(ILI9341_BLUE);
//tft.setTextColor(ILI9341_RED);
tft.setCursor(5, 150);
tft.setTextSize(3);
tft.println("FM");
tft.setCursor(60, 150);
tft.setTextSize(5);
tft.println("105.25");
tft.setCursor(240, 165);
tft.setTextSize(3);
tft.println(" MHz");
tft.drawLine(5, 40, 315, 40, ILI9341_CYAN);
tft.drawRect(5, 60, 310, 60, ILI9341_BLACK);
tft.drawRect(0, 0, 320, 240, ILI9341_RED);
//tft.drawLine(15, 90, 15, 115, ILI9341_CYAN);
//tft.drawLine(20, 105, 20, 115, ILI9341_CYAN);
drawScale();
tft.setCursor(10, 65);
tft.setTextSize(2);
tft.println("87");
tft.setCursor(275, 65);
tft.println("108");
}
void loop()
{
for (int dial = 10; dial < 310; dial += 5)
{
tft.drawLine(dial, 85, dial, 115, ILI9341_RED);
tft.drawLine(dial + 1, 85, dial + 1, 115, ILI9341_RED);
delay(100);
tft.drawLine(dial, 85, dial, 115, ILI9341_WHITE);
tft.drawLine(dial + 1, 85, dial + 1, 115, ILI9341_WHITE);
drawScale();
}
}
void drawScale()
{
for (int i = 10; i < 310; i += 10) {
tft.drawLine(i, 100, i, 115, ILI9341_CYAN);
tft.drawLine(i + 1, 100, i + 1, 115, ILI9341_CYAN);
}
for (int j = 15; j < 310; j += 10) {
tft.drawLine(j, 105, j, 115, ILI9341_MAGENTA);
tft.drawLine(j + 1, 105, j + 1, 115, ILI9341_MAGENTA);
}
}