#include <WiFi.h>
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#include <Wire.h>
#include "SPI.h"
/* //ESP32-C3-MINI-1 PINOUT
#define TFT_CS 10
#define TFT_DC 19
//#define TFT_LED 3.3V
//#define TFT_RST RST
#define TFT_MOSI 07
#define TFT_CLK 06
#define TFT_MISO 02
*/
#define TFT_CS 10
#define TFT_DC 19
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
#define BLACK 0X0000
#define RED 0xF800
#define GREEN 0x07E0
#define CELESTE 0x79E0
#define BLUE2 0x0110
#define BLUE 0x102E
#define CYAN 0x07FF
#define CYAN2 0x3333
#define YELLOW 0xFFE0
#define ORANGE 0xFD20
#define ORANGE2 0xFE52
#define NARANJO 0x1358
#define GREENYELLOW 0xAFE5
#define DARKGREEN 0x04E0 //0x03E0
#define WHITE 0xFFFF
#define GRIS 0x5AEB
#define VIOLETA 0xFCFD
#define DARKGREY 0x7BEF
void setup() {
tft.begin();
tft.setRotation(0);
tft.setCursor(0, 30);
tft.setTextSize(2);
tft.setTextColor(GREEN);
tft.print("este es esp32-c3-mini-1");
delay(300);
Serial.begin(9600);
Serial.print("Connecting to WiFi");
WiFi.begin("Wokwi-GUEST", "", 6);
int x = 0; int y=100;
while (WiFi.status() != WL_CONNECTED) {
x=x+10;
tft.setTextWrap(true);
tft.setTextSize(2);
tft.setTextColor(WHITE, BLACK);
tft.setCursor(x, y);
tft.print(".");
Serial.print(".");
delay(100);
}
tft.setCursor(60, y+40);
tft.print("Connected");
Serial.println(" Connected!");
delay(150);
tft.setTextColor(CYAN2);
tft.setCursor(0, y+80);
tft.println(F("IP address is: "));
tft.println(WiFi.localIP());
}
void loop() {
if ((WiFi.status() != WL_CONNECTED)) {
tft.setCursor(0, 200);
tft.setTextColor(RED, BLACK);
tft.print("connection lost");
delay(100);
}
}