Post your best Lua script examples here
User avatar
By slepre
#78194 Hi All,

Have some laying TM1640 based 8x8 led matrix (aka Wemos Led Matrix Shield) and a D1 Mini or D1 Pro?
There is plenty of Arduino code available but nothing for LUA...
The main issue is that the TM1640 chip uses a 'non standrard' SPI protocol on two wires only. Thanks to Markus Gritsch with his BIT-BANGING, PERFORMANCE, AND LUA TABLE LOOKUPS article I was able to quite successfully drive the TM1640 chip directly from LUA.

As you can see in the picture I have 3 independent Led Matrices controlled from a single ESP8266 using a total of 4 GPIOs and able to refresh <50ms... not bad I think.

You can find more details and some very basic (and ugly) example code on Github:

https://github.com/slepre/TM1640_LUA
Image
Enjoy!