Conflitto GPS - OLED 128x32

Ciao a tutti ho dei problemi ad utilizzare il modulo GPS (GY-NEO6MV2 ) combinato con il monitor OLED 128x32 (0.91" IIC I2C SPI128x32), vorrei visualizzare le coordinate gps sul monitor:

#include <SoftwareSerial.h>
#include <TinyGPS.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);

/* This sample code demonstrates the normal use of a TinyGPS object.
   It requires the use of SoftwareSerial, and assumes that you have a
   4800-baud serial GPS device hooked up on pins 4(rx) and 3(tx).
*/

TinyGPS gps;
SoftwareSerial ss(4, 3);

void setup()
{
  // by default, we'll generate the high voltage from the 3.3v line internally! (neat!)
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3C (for the 128x32)
  // init done
  Serial.begin(115200);
  ss.begin(9600);
  
  Serial.print("Simple TinyGPS library v. "); Serial.println(TinyGPS::library_version());
  Serial.println("by Mikal Hart");
  Serial.println();

}

void loop()
{
  bool newData = false;
  unsigned long chars;
  unsigned short sentences, failed;

  // For one second we parse GPS data and report some key values
  for (unsigned long start = millis(); millis() - start < 1000;)
  {
    while (ss.available())
    {
      char c = ss.read();
      // Serial.write(c); // uncomment this line if you want to see the GPS data flowing
      if (gps.encode(c)) // Did a new valid sentence come in?
        newData = true;
    }
  }

  if (newData)
  {
    float flat, flon;
    unsigned long age;
    gps.f_get_position(&flat, &flon, &age);
    Serial.print("LAT=");
    Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
    Serial.print(" LON=");
    Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
    Serial.print(" SAT=");
    Serial.print(gps.satellites() == TinyGPS::GPS_INVALID_SATELLITES ? 0 : gps.satellites());
    Serial.print(" PREC=");
    Serial.print(gps.hdop() == TinyGPS::GPS_INVALID_HDOP ? 0 : gps.hdop());

      display.clearDisplay();     // stampa su display
      display.setTextColor(WHITE);
      display.setTextSize(1);
      display.setCursor(0,0); 

      display.print("Lat: ");
      display.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
      display.print(" Lon: ");
      display.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
      display.display();
      
  }
  
  gps.stats(&chars, &sentences, &failed);
  Serial.print(" CHARS=");
  Serial.print(chars);
  Serial.print(" SENTENCES=");
  Serial.print(sentences);
  Serial.print(" CSUM ERR=");
  Serial.println(failed);
  if (chars == 0)
    Serial.println("** No characters received from GPS: check wiring **");
}

in particolare ho fatto alcune prove, togliendo questa riga il monitor seriale mi dà le coordinate giuste ma l'OLED non funziona, lasciandola l'OLED funziona ma non riceve le coordinate perchè restano a 0...

display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3C (for the 128x32)

ho provato a cercare nelle librerie ma non son riuscito a capire cosa c'è che non va :frowning:
qualcuno può aiutarmi?
Grazie

Hello Stupendoman! I ran into the same problem. Luckily, I found an error. The fact is that in these lines IDE thinks that you are using the same pins:

#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
SoftwareSerial ss(4, 3);

although in fact they are different.

To solve this problem, it is necessary just to clarify one of the parameters:

Adafruit_SSD1306 display(A4);

After that, everything should work! Good luck!

>AlexTeos: hi, this is the ITALIAN section of the forum, so, please, write in Italian (at least use Google Translator); next, the question is from April ... I suppose "Stupendoman" now (7 months later) solved his problem; to finish, please follow the rules of Italian section:

... essendo il tuo primo post, nel rispetto del regolamento (… punto 13, primo capoverso), ti chiedo cortesemente di presentarti IN QUESTO THREAD (spiegando bene quali conoscenze hai di elettronica e di programmazione ... possibilmente evitando di scrivere solo una riga di saluto) e di leggere con MOLTA attenzione il su citato REGOLAMENTO ... Grazie.

Guglielmo