Troublesome luacontroller loop

Quackor
New member
 
Posts: 4
Joined: Sun Nov 24, 2013 23:07

Troublesome luacontroller loop

by Quackor » Sun Nov 24, 2013 23:12

I'm trying to have one of my outputs send a signal for half a second every 5 seconds or so... this code runs but slowly gets crazier and crazier (as in the port outputs more often, until it overheats... am I missing something fundamental here?)

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
interrupt(0.5, "loop")

if mem.count == nil then
  mem.count = 0
end

if event.iid == "loop" then
  mem.count = mem.count + 1
  if mem.count == 10 then
    port.c = true
    mem.count = 0
  else
    port.c = false
  end
end


Any help figuring this one out greatly appreciated!
Last edited by Quackor on Sun Nov 24, 2013 23:17, edited 1 time in total.
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Sun Nov 24, 2013 23:20

I guess this would fit better into the mesecons topic.
Last edited by PilzAdam on Sun Nov 24, 2013 23:20, edited 1 time in total.
 

Quackor
New member
 
Posts: 4
Joined: Sun Nov 24, 2013 23:07

by Quackor » Sun Nov 24, 2013 23:24

PilzAdam wrote:I guess this would fit better into the mesecons topic.


Directing all mod-related questions into a single topic seems messy... maybe it would be useful to have a forum section dedicated to mod functionality? not sure :/ I'll respost this in the messecons topic just in case.
 


Return to Minetest Features

Who is online

Users browsing this forum: No registered users and 3 guests

cron