Created
May 11, 2016 01:46
-
-
Save alexdmejias/9c245ed21f4989be148a9ce6f32f4231 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Wire.h" | |
extern "C" { | |
#include "utility/twi.h" // from Wire library, so we can do bus scanning | |
} | |
#define TCAADDR 0x70 | |
void tcaselect(uint8_t i) { | |
if (i > 7) return; | |
Wire.beginTransmission(TCAADDR); | |
Wire.write(1 << i); | |
Wire.endTransmission(); | |
} | |
#include <Adafruit_GFX.h> | |
#include <Adafruit_SSD1306.h> | |
Adafruit_SSD1306 display1 = Adafruit_SSD1306(-1); | |
Adafruit_SSD1306 display2 = Adafruit_SSD1306(-1); | |
Adafruit_SSD1306 display3 = Adafruit_SSD1306(-1); | |
Adafruit_SSD1306 display4 = Adafruit_SSD1306(-1); | |
int one = 0; | |
int two = 5; | |
int three = 7; | |
int four = 6; | |
void displayNumber(Adafruit_SSD1306* disp) { | |
disp->clearDisplay(); | |
disp->setTextSize(1); | |
disp->setTextColor(WHITE); | |
disp->setCursor(0,0); | |
disp->println("asd"); | |
disp->display(); | |
} | |
void setup() { | |
Wire.begin(); | |
Serial.begin(9600); | |
tcaselect(one); | |
display1.begin(SSD1306_SWITCHCAPVCC, 0x3C, false); // initialize with the I2C addr 0x3D (for the 128x64) | |
tcaselect(two); | |
display2.begin(SSD1306_SWITCHCAPVCC, 0x3C, false); // initialize with the I2C addr 0x3D (for the 128x64) | |
tcaselect(three); | |
display3.begin(SSD1306_SWITCHCAPVCC, 0x3C, false); // initialize with the I2C addr 0x3D (for the 128x64) | |
tcaselect(four); | |
display4.begin(SSD1306_SWITCHCAPVCC, 0x3C, false); // initialize with the I2C addr 0x3D (for the 128x64) | |
tcaselect(one); | |
display1.display(); | |
tcaselect(two); | |
display2.display(); | |
tcaselect(three); | |
display3.display(); | |
tcaselect(four); | |
display4.display(); | |
tcaselect(one); | |
display1.clearDisplay(); | |
tcaselect(two); | |
display2.clearDisplay(); | |
tcaselect(three); | |
display3.clearDisplay(); | |
tcaselect(four); | |
display4.clearDisplay(); | |
tcaselect(one); | |
displayNumber(&display1); | |
// tcaselect(two); | |
// displayNumber(display2); | |
// tcaselect(three); | |
// displayNumber(display3); | |
// tcaselect(four); | |
// displayNumber(display4); | |
} | |
void loop() { | |
// put your main code here, to run repeatedly: | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment