The LED matrix on the Sino:bit has several important differences from the one found on the Micro:bit.
The most obvious is that it is a 12x12 matrix rather than a 5x5 one. That's 144 LEDs instead of 25. The primary reason for this is to support non-roman alphabets, for which 5x5 is far to small. Even if you don't need that capability, the larger display space is incredibly useful. The Sino:bit library works in conjunction with the GFX library to provide graphics primitives that can be used to good effect on the larger matrix. To demonstrate this, one of the examples with the library is an implementation of Conway's Game of Life, based on the code at https://learn.adafruit.com/mini-commodore-pet-with-charlieplexed-led-matrix/software.
The LED matrix is not managed by the MCU as it is on the Micro:bit; it would take to much of the MCU's time. The designers of the Sino:bit used the Holtek HT1632 to manage the LEDs. All the MCU has to do is tell the HT1632 the state of each LED. As a result there is more computing power available to use for our code.
The Sino:bit library handles all that for you, letting you work with it via the GFX primitives. Here's a slightly different button example that uses the LEDs to indicate button state.
#include <sinobit.h> Sinobit matrix = Sinobit(); void setup() { matrix.begin(); delay(100); matrix.clearScreen(); matrix.setTextWrap(false); pinMode(SINOBIT_BUTTON_A, INPUT); pinMode(SINOBIT_BUTTON_B, INPUT); } void loop() { if (!digitalRead(SINOBIT_BUTTON_A)) { matrix.drawLine(7, 1, 11, 5, 1); matrix.drawLine(7, 10, 11, 6, 1); } else { matrix.drawLine(7, 1, 11, 5, 0); matrix.drawLine(7, 10, 11, 6, 0); } if (!digitalRead(SINOBIT_BUTTON_B)) { matrix.drawLine(4, 1, 0, 5, 1); matrix.drawLine(4, 10, 0, 6, 1); } else { matrix.drawLine(4, 1, 0, 5, 0); matrix.drawLine(4, 10, 0, 6, 0); } matrix.writeScreen(); }
Text editor powered by tinymce.