|
|
@@ -65,6 +65,7 @@ void OLED_test() { //pantallazo a blanco y luego iniciando
|
|
|
display.clearDisplay();
|
|
|
display.fillScreen(SSD1306_WHITE); // Pantalla blanca
|
|
|
display.display();
|
|
|
+ delay(5000);
|
|
|
display.clearDisplay();
|
|
|
display.setTextSize(2); // Tamaño texto
|
|
|
display.setTextColor(SSD1306_WHITE);
|
|
|
@@ -126,51 +127,6 @@ void setup() {
|
|
|
//revisar toda esta parte, generada por copilot##########################################################
|
|
|
void loop() {
|
|
|
|
|
|
- // GPS check
|
|
|
- if (gpsFlag) {
|
|
|
- gpsFlag = false;
|
|
|
- while (gpsSerial.available() > 0) {
|
|
|
- gps.encode(gpsSerial.read());
|
|
|
- }
|
|
|
- if (gps.location.isValid()) {
|
|
|
- Serial.print("Latitude: ");
|
|
|
- Serial.println(gps.location.lat(), 6);
|
|
|
- Serial.print("Longitude: ");
|
|
|
- Serial.println(gps.location.lng(), 6);
|
|
|
- } else {
|
|
|
- Serial.println("GPS: Waiting for fix...");
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- // SD Card check (write and read once)
|
|
|
- static bool sdChecked = false;
|
|
|
- if (!sdChecked) {
|
|
|
- sdChecked = true;
|
|
|
- File file = SD.open("test.txt", FILE_WRITE);
|
|
|
- if (file) {
|
|
|
- file.printf("Temp: %.1f C, Hum: %.1f %%\n", t, h);
|
|
|
- if (gps.location.isValid()) {
|
|
|
- file.printf("Lat: %.4f, Lon: %.4f\n", gps.location.lat(), gps.location.lng());
|
|
|
- } else {
|
|
|
- file.println("GPS: No fix");
|
|
|
- }
|
|
|
- file.close();
|
|
|
- Serial.println("Data written to SD card");
|
|
|
- } else {
|
|
|
- Serial.println("Failed to open file for writing on SD");
|
|
|
- }
|
|
|
-
|
|
|
- // Read back
|
|
|
- file = SD.open("test.txt", FILE_READ);
|
|
|
- if (file) {
|
|
|
- Serial.println("Reading from SD card:");
|
|
|
- while (file.available()) {
|
|
|
- Serial.write(file.read());
|
|
|
- }
|
|
|
- file.close();
|
|
|
- } else {
|
|
|
- Serial.println("Failed to open file for reading on SD");
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
}
|