TangentFox

Multi-port timer v2 (for minetest luacontroller)

Apr 29th, 2019 (edited)
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.32 KB | None | 0 0
  1. local seq = 2
  2.  
  3. if event.type == "program" then
  4.   interrupt(seq, 0)
  5.   mem.a = 4
  6.   mem.b = 3
  7.   mem.d = 1
  8.  
  9. elseif event.type == "interrupt" then
  10.   for direction, timing in pairs(mem) do
  11.     if event.iid % timing == 0 then
  12.       port[direction] = not pin[direction]
  13.     end
  14.   end
  15.   interrupt(seq, event.iid + 1)
  16. end
Add Comment
Please, Sign In to add comment