Somehow the Calliope Mini has too few inputs and outputs for traffic light projects and the like which I would like to do in higher classes. A remedy is an IO-Port Expander. In our case the MCP23017. It offers 2x8 thus 16 inputs and outputs. Every single port has to be programmed as input as well as output. You can assign up to 8 different hardware addresses to the MCP23017 and then use up to 8x16=128 ports. This should be enough for everything.
Basis for everything were the articles of Robert Fromm:
Arduino and I2C (where you can also find the circuit diagram) and Calliope Mini and I2C
Read and be enthusiastic! Thank you Robert!
And it applies as for many Calliope materials
Robert Fromm and Michael Klein
So here's the variant about Custom Blocks:
click on the arrow in Explorer
the explorer opens and we click on the + button.
a new file custom.ts appears
delete the example file here and insert my version. By clicking on Blocks we have a new Custom Block Menu with the desired functions:
And the sample program written out:
If key 1&2 is pressed (bit values are added) LED 1 and 2 are switched on. LED 2 for key 2 and LED 3 for key 3.
If the LED is to go out after the key has been released, the last otherwise branch should be set to
must be inserted.
In the meantime I also managed to create a package:
And here the whole thing with a professionally manufactured circuit board and a suitable project on Hackster.