#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#define TFT_DC 2
#define TFT_CS 3
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
void setup() {
Serial.begin(115200);
Serial.println(" shapes on Nucleo-32 SPI अरविन्द पाटील ...");
delay(500);
Serial.println(" इस कोड की रचना अरविन्द द्वारा 17/11/23 ");
delay(1000);
tft.begin();
// Display three filled circles with different colors
tft.fillCircle(60, 100, 20, ILI9341_RED); // Circle 1 (x=60, y=100, radius=20)
tft.fillCircle(120, 100, 20, ILI9341_GREEN); // Circle 2 (x=120, y=100, radius=20)
tft.fillCircle(180, 100, 20, ILI9341_BLUE); // Circle 3 (x=180, y=100, radius=20)
// Draw a square with a color range below the circles
drawColorRangeSquare();
// Add text by Arvind Patil in yellow color
tft.setTextColor(ILI9341_YELLOW);
tft.setTextSize(2);
tft.setCursor(10, 230);
tft.print("Arvind Patil");
tft.setTextColor(ILI9341_RED);
tft.setTextSize(2);
tft.setCursor(10, 20);
tft.print("whatsapp 917020336035");
}
void drawColorRangeSquare() {
int squareSize = 240;
int startX = 00;
int startY = 160;
for (int i = 0; i < squareSize; i++) {
int color = colorRangeMap(i, 0, squareSize, ILI9341_RED, ILI9341_BLUE);
tft.drawFastHLine(startX, startY + i, squareSize, color);
}
}
int colorRangeMap(int value, int in_min, int in_max, int out_min, int out_max) {
return (value - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}
void loop() {
// Your main code here
}