Closed GeorgeFlorian closed 5 years ago
I've tried the following sketch:
#include <Arduino.h> #include <WiFi.h> #include <Adafruit_GFX.h> #include <Fonts/FreeSans9pt7b.h> #include <P3RGB64x32MatrixPanel.h> #include <time.h> #include <SPI.h> P3RGB64x32MatrixPanel matrix; const char* ssid = "ssid"; const char* password = "password"; #define TZ (2*60*60) //UTC + 2 void printLocalTime() { struct tm timeinfo; if(!getLocalTime(&timeinfo)){ Serial.println("Failed to obtain time"); return; } Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S"); } void setup() { Serial.begin(115200); delay(1000); Serial.println((String)"Attempting to connect to " + ssid); WiFi.begin(ssid,password); delay(500); int k = 0; while(WiFi.status() != WL_CONNECTED && k<20) { Serial.println((String)"Attempt number: " + (k+1)); k++; delay(1000); } IPAddress ip = WiFi.localIP(); if(WiFi.status() != WL_CONNECTED) { ESP.restart(); } else { Serial.println((String)"Connected to *" + ssid + "* ! IP Address: " + ip.toString()); } configTime(TZ, 0, "europe.pool.ntp.org", "0.ro.pool.ntp.org"); printLocalTime(); matrix.begin(); delay(500); matrix.setTextColor(matrix.color444(180,0,0)); matrix.setFont(&FreeSans9pt7b); matrix.println("IP Address: "); matrix.setTextColor(matrix.color444(255,255,255)); matrix.println(ip); } void loop() { delay(1000); printLocalTime(); }
And I keep getting: .piolibdeps/Adafruit GFX Library_ID13/Adafruit_SPITFT.h:25:17: fatal error: SPI.h: No such file or directory
.piolibdeps/Adafruit GFX Library_ID13/Adafruit_SPITFT.h:25:17: fatal error: SPI.h: No such file or directory
The easy fix is to write #include <SPI.h> in the sketch.
#include <SPI.h>
But I don't see #include <SPI.h> in any of your examples. How's that ? Why do I need it and you don't ?
Please ask in the Adafruit_GFX library community.
I've tried the following sketch:
And I keep getting:
.piolibdeps/Adafruit GFX Library_ID13/Adafruit_SPITFT.h:25:17: fatal error: SPI.h: No such file or directory
The easy fix is to write
#include <SPI.h>
in the sketch.But I don't see
#include <SPI.h>
in any of your examples. How's that ? Why do I need it and you don't ?