Created
April 24, 2017 02:21
-
-
Save profburke/2196c47430d28ade8f5c5eb7e801e421 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- make use of morse.lua to do morse code via | |
-- LEDs on an ESP8266 | |
-- first, rough attempt | |
morse = dofile 'morse.lua' | |
DOTPIN = 2 | |
DASHPIN = 1 | |
_sleep = 10000 | |
sleep = function() tmr.delay(_sleep) end | |
on = function(p) gpio.write(p, gpio.HIGH) end | |
off = function(p) gpio.write(p, gpio.LOW) end | |
leddot = function() on(DOTPIN); sleep(); off(DOTPIN) end | |
leddash = function() on(DASHPIN); sleep(); sleep(); sleep(); | |
off(DASHPIN) end | |
morse.setDotGenerator(function() leddot() end) | |
morse.setDashGenerator(function() leddash() end) | |
morse.setBlankGenerator(function() sleep() end) | |
morse.setCleanupFunction(function() end) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment