hello
my adafruit TCA9548A arrived and i connected it to SDA1 SCL1 pins 37,38 on teensy.
i run i2c scanner and i find the address 0x70 under WIRE1.
im trying to run 8 oled screen 128x64 connected to the TCA9548A
all the pullups working well and i measure all SDA SCL pins and i got 3.3 on all of them so the schem is ok.
this is code to test im trying to run i change all the WIRE. to WIRE1
and i add the u8glib.begin() in the loop but its stiil not operate any of my screens.
please help me to figure out what im doing wrong.
the code im using:
tnx
rota
my adafruit TCA9548A arrived and i connected it to SDA1 SCL1 pins 37,38 on teensy.
i run i2c scanner and i find the address 0x70 under WIRE1.
im trying to run 8 oled screen 128x64 connected to the TCA9548A
all the pullups working well and i measure all SDA SCL pins and i got 3.3 on all of them so the schem is ok.
this is code to test im trying to run i change all the WIRE. to WIRE1
and i add the u8glib.begin() in the loop but its stiil not operate any of my screens.
please help me to figure out what im doing wrong.
the code im using:
Code:
#include <Wire.h>
#include <U8glib.h>
#define TCAADDR 0x70 // TCA9548A Encoder address
char tmp_string[8]; //Temp string to convert numeric values to string before print to OLED display
int n=0; // Loop counter, to verify that data is updated at the display
uint8_t t=0; // Port selection (0...7)
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_FAST); // Fast I2C / TWI
void tcaselect(uint8_t i) {
if (i > 7) return;
Wire1.beginTransmission(TCAADDR);
Wire1.write(1 << i);
Wire1.endTransmission();
}
void setup(){
DisplayInit();
}
void draw(void) {
u8g.setFont(u8g_font_ncenB10);
u8g.drawStr(0, 13, "Port =");
itoa(t, tmp_string, 10);
u8g.drawStr(50, 13, tmp_string);
u8g.drawStr(0, 50, "n =");
itoa(n, tmp_string, 10);
u8g.setFont(u8g_font_ncenB18);
u8g.drawStr(25, 50, tmp_string);
}
void DisplayInit(){
for (t=0; t<7; t++) {
tcaselect(t);
u8g.firstPage();
do {
u8g.begin(); // Initialize display
} while( u8g.nextPage() );
}
}
void loop(){
for (t=0; t<7; t++) {
tcaselect(t);
u8g.begin();
// picture loop
u8g.firstPage();
do {
draw();
} while( u8g.nextPage() );
delay(50);
}
n=n+1;
delay(500);
}
tnx
rota