Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ESP8266WiFi.h>
- #include <WiFiClient.h>
- #include <Adafruit_GFX.h>
- #include <Adafruit_ST7735.h>
- const char* ssid = "mySSID";
- const char* password = "myPassword";
- //LED Setup
- int LEDrot = D0;
- int LEDblau = D3;
- // ST7735 TFT Verbindungen
- #define TFT_RST -1
- #define TFT_CS D8
- #define TFT_DC D4
- Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
- byte mac[6];
- IPAddress ip;
- void setup() {
- //LED initialisieren -> LED aus
- pinMode(LEDrot, OUTPUT);
- pinMode(LEDblau,OUTPUT);
- digitalWrite(LEDrot, LOW);
- digitalWrite(LEDblau, LOW);
- tft.initR(INITR_BLACKTAB);
- tft.fillScreen(ST7735_BLACK);
- // statische Anzeige
- tft.drawFastHLine(0, 50, tft.width(), ST7735_WHITE);
- tft.drawFastHLine(0, 106, tft.width(), ST7735_WHITE);
- tft.setTextColor(ST7735_ORANGE, ST7735_BLACK);
- tft.setTextSize(1);
- tft.setCursor(4, 16); tft.print("ESP8266 + ST7735 TFT");
- tft.setCursor(12, 33); tft.print("IP- & MAC-Adresse");
- tft.setTextColor(ST7735_GREEN, ST7735_BLACK);
- tft.setCursor(32, 61); tft.print("IP-Adresse");
- tft.setCursor(30, 118); tft.print("MAC-Adresse");
- WiFi.mode(WIFI_STA);
- WiFi.begin(ssid, password);
- while (WiFi.status() != WL_CONNECTED) {
- delay(1000);
- }
- ip = WiFi.localIP();
- WiFi.macAddress(mac);
- }
- void loop() {
- // Anzeige IP-Adresse
- tft.setTextColor(ST7735_YELLOW, ST7735_BLACK);
- tft.setCursor(19, 82); tft.print(ip);
- // Anzeige MAC-Adresse
- tft.setTextColor(ST7735_YELLOW, ST7735_BLACK);
- tft.setCursor(14, 140); tft.print(mac[0],HEX); tft.print(":");
- tft.print(mac[1],HEX); tft.print(":");
- tft.print(mac[2],HEX); tft.print(":");
- tft.print(mac[3],HEX); tft.print(":");
- tft.print(mac[4],HEX); tft.print(":");
- tft.print(mac[5],HEX);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement