Skip to content

Commit 3b3b9a6

Browse files
committed
Allow to specify I2C address
1 parent 3171b82 commit 3b3b9a6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Modulino_LED_Matrix.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
#define DEFAULT_WIRE Wire
2424
#endif
2525

26+
#define DEFAULT_ADDRESS 0x39
27+
2628
class ModulinoLEDMatrix
2729
#ifdef MATRIX_WITH_ARDUINOGRAPHICS
2830
: public ArduinoGraphics
@@ -42,7 +44,8 @@ class ModulinoLEDMatrix
4244
void autoscroll(uint32_t interval_ms) {
4345
_interval = interval_ms;
4446
}
45-
int begin() {
47+
int begin(uint8_t address = DEFAULT_ADDRESS) {
48+
_address = address;
4649
bool rv = true;
4750
_wire->begin();
4851
return rv;
@@ -63,7 +66,7 @@ class ModulinoLEDMatrix
6366
}
6467
_sequenceDone = true;
6568
}
66-
_wire->beginTransmission(0x39);
69+
_wire->beginTransmission(_address);
6770
_wire->write((uint8_t*)frame, sizeof(frame));
6871
_wire->endTransmission();
6972
}
@@ -219,4 +222,5 @@ class ModulinoLEDMatrix
219222
bool _sequenceDone = false;
220223
voidFuncPtr _callBack = nullptr;
221224
HardwareI2C* _wire;
225+
uint8_t _address = 0;
222226
};

0 commit comments

Comments
 (0)