Arduino Library
The Soldered Inputronic GRID library talks to the ATtiny404 on the board
over I2C. Include InputronicGrid.h, create one InputronicGrid object and call
begin(); then you read the pads and set the LEDs with short function calls.
Not installed yet? Follow Quick Start before using the functionality pages.
How pads and LEDs are numbered
- By row and column.
readPad(row, col)and the six-argumentsetLED(row, col, r, g, b, intensity)take a row from 0 to 3 (top to bottom) and a column from 0 to 3 (left to right). Both point at the same pad. - By index.
readButton(index)counts the buttons row by row:index = row * 4 + col. The five-argumentsetLED(index, r, g, b, intensity)counts the LEDs in the order they sit on the data line, which runs left to right on even rows and right to left on odd rows. On rows 1 and 3 the two index numbers therefore point at different pads; use the row and column form when you want a button and its LED to match. - As a 16-bit mask.
readAllPads()returns bitifor buttoni, counted row by row.setLEDMask(mask, r, g, b)lights LEDiin data-line order for biti, the same numbering as the five-argumentsetLED(), and turns every other LED off. On rows 1 and 3, a bit in thereadAllPads()mask and the same bit in thesetLEDMask()mask point at different pads.
readButton(), readAllPads() and setLEDMask() are in the library at this
commit, but no example uses them yet.
Functionality
Each page starts with one verified library example and explains every function the example uses to get that result.
Arduino exampleLight a pad when you press itEach press toggles that pad's LED in its row's colour. ButtonLEDControl.ino.Arduino exampleRead the buttonsPrints a 4x4 map of pressed and released pads every 50 ms. ReadButtons.ino.Arduino exampleSet the LED coloursSweeps every LED through red, green and blue, then fills the whole grid. SetLEDs.ino.Arduino exampleChange the I2C addressMoves the board from 0x30 to a new address that it keeps after power-off. ChangeAddress.ino.