Skip to content

Instantly share code, notes, and snippets.

View marcelstoer's full-sized avatar
👨‍👩‍👧‍👧
The Earth was made round so that we would not see too far down the road - K.B.

Marcel Stör marcelstoer

👨‍👩‍👧‍👧
The Earth was made round so that we would not see too far down the road - K.B.
View GitHub Profile
@marcelstoer
marcelstoer / debounce-with-tmr.lua
Last active December 7, 2019 06:05
NodeMCU debounce based on timer with GPIO pullup
-- inspired by https://github.com/hackhitchin/esp8266-co-uk/blob/master/tutorials/introduction-to-gpio-api.md
-- and http://www.esp8266.com/viewtopic.php?f=24&t=4833&start=5#p29127
local pin = 4 --> GPIO2
function debounce (func)
local last = 0
local delay = 50000 -- 50ms * 1000 as tmr.now() has μs resolution
return function (...)
local now = tmr.now()
@marcelstoer
marcelstoer / moody.lua
Last active June 9, 2016 19:35
Moody: NodeMCU with MAX7219 8x8 matrix display (SPI)
MAX7219_REG_NOOP = 0x00
MAX7219_REG_DECODEMODE = 0x09
MAX7219_REG_INTENSITY = 0x0A
MAX7219_REG_SCANLIMIT = 0x0B
MAX7219_REG_SHUTDOWN = 0x0C
MAX7219_REG_DISPLAYTEST = 0x0F
happy = {0x3C, 0x42, 0xA5, 0x81, 0xA5, 0x99, 0x42, 0x3C}
frown = {0x3C, 0x42, 0xA5, 0x81, 0xBD, 0x81, 0x42, 0x3C}
sad = {0x3C, 0x42, 0xA5, 0x81, 0x99, 0xA5, 0x42, 0x3C}