I've connected a Metro Mini v2 (https://www.adafruit.com/product/5597) with a FeatherWing OLED (https://learn.adafruit.com/adafruit-128 ... g/overview) over STEMMA QT (I2C). When also connecting an Adafruit Mini GPS PA1010D Module (https://learn.adafruit.com/adafruit-min ... e/overview) over the same I2C it seems I'm only able to connect to one of the I2C devices and not both at the same time, despite they having different addresses.
Here's my connection: Here's my code (when uncommenting "Adafruit_GPS GPS(&Wire);" and "GPS.begin(0x10);" the connection to the I2C is no longer working):
Code: Select all
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH110X.h>
#include <Adafruit_GPS.h>
// Connect to the OLED on the hardware I2C port
Adafruit_SH1107 display = Adafruit_SH1107(64, 128, &Wire);
// Connect to the GPS on the hardware I2C port
// Adafruit_GPS GPS(&Wire);
#define BUTTON_UP 9
#define BUTTON_ENTER 8
#define BUTTON_DOWN 7
#define BUTTON_BACK 6
void setup() {
// wait for hardware serial to appear
while (!Serial);
Serial.begin(115200);
Serial.println("Connecting to OLED");
display.begin(0x3C, true); // Address 0x3C default
display.display(); // show splash-screen
delay(2000);
display.setRotation(3); // set correct rotation
display.setTextSize(1); // set correct text size
display.setTextColor(SH110X_WHITE); // set correct text color
display.setCursor(0,0); // start at 0,0 coordinates
display.clearDisplay(); // Remove splash-screen
delay(1000);
Serial.println("Connected to OLED");
display.println("Connected to OLED");
display.display();
delay(1000);
Serial.println("Connecting to GPS");
display.println("Connecting to GPS");
display.display();
// GPS.begin(0x10); // Address 0x10 default
delay(1000); // wait for the GPS to power up - probably not necessary
Serial.println("Completed");
display.println("Completed");
display.display();
delay(1000);
Serial.println("Setting up buttons");
display.println("Setting up buttons");
display.display();
delay(1000);
pinMode(BUTTON_UP, INPUT_PULLUP);
pinMode(BUTTON_ENTER, INPUT_PULLUP);
pinMode(BUTTON_DOWN, INPUT_PULLUP);
pinMode(BUTTON_BACK, INPUT_PULLUP);
Serial.println("Completed");
display.println("Completed");
display.display();
delay(1000);
}
void loop() {
// if (Serial.available()) {
// char c = Serial.read();
// GPS.write(c);
// }
// if (GPS.available()) {
// char c = GPS.read();
// Serial.write(c);
// }
if(!digitalRead(BUTTON_UP)) display.print("C");
if(!digitalRead(BUTTON_ENTER)) display.print("B");
if(!digitalRead(BUTTON_DOWN)) display.print("A");
if(!digitalRead(BUTTON_BACK)) display.print("D");
delay(10);
yield();
display.display();
}