Skip to content

Commit 95c7be2

Browse files
committed
Add info on how to use multiple modulinos
1 parent c674baf commit 95c7be2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docs/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@ When using this library on a non-Arduino board, the I2C bus must be initialized
1717
Usually the available I2C buses are predefined and can be accessed by their number, e.g. I2C(0).
1818
If not, the pins for SDA and SCL must be specified. An example on how to do this can be found [here](../examples/third_party_board.py).
1919

20+
## 🕹️🕹️ Using multiple Modulinos of the same type
21+
22+
When using multiple Modulinos of the same type, you can create separate instances for each one by specifying different I2C addresses. For that to work, make sure to change their I2C address to a unique one by running the `change_address.py` script in the examples folder. This only works for Modulino models that support changing the I2C address (e.g., ModulinoButtons, ModulinoBuzzer, ModulinoKnob, ModulinoPixels).
23+
24+
```python
25+
from modulino import ModulinoButtons
26+
27+
buttons1 = ModulinoButtons(address=0x10)
28+
buttons2 = ModulinoButtons(address=0x11)
29+
30+
print("Button A on Modulino 1 is pressed:", buttons1.button_a_pressed)
31+
print("Button A on Modulino 2 is pressed:", buttons2.button_a_pressed)
32+
```
33+
2034
## 👀 Examples
2135

2236
The following scripts are examples of how to use the Modulinos with Python:

0 commit comments

Comments
 (0)