Skip to content

Instantly share code, notes, and snippets.

@Cvar1984
Created October 21, 2020 04:42
Show Gist options
  • Save Cvar1984/61aeb5c88bcf74172fe9350432210c2f to your computer and use it in GitHub Desktop.
Save Cvar1984/61aeb5c88bcf74172fe9350432210c2f to your computer and use it in GitHub Desktop.
local cron = require 'cron'
relay = {0, 1, 2, 3};
for x in pairs(relay) do
gpio.mode(relay[x], gpio.OUTPUT);
end
pulser = gpio.pulse.build({
{
[relay[1]] = gpio.HIGH,
[relay[2]] = gpio.LOW,
delay = 999
},
{
[relay[1]] = gpio.LOW,
[relay[2]] = gpio.HIGH,
delay = 999
}
});
blink = cron.schedule("* * * * *", function()
print('tick');
pulser:start(function(pos, steps, offset, now)
print(pos, steps, offset, now);
return true;
end);
return true;
end);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment