Jump to content




Computerized Timer?


  • You cannot reply to this topic
5 replies to this topic

#1 Tyken132

  • Members
  • 3 posts

Posted 17 April 2013 - 07:40 PM

I have a mobile lava pumping station and I wanted it to automatically move every few hours on its own. I considered using a RP2 timer but you can only add 10 seconds at a time and well...that is far too much clicking.

So, I was wondering if someone could help me with a simple code to make a computer pulse every few hours then start a new countdown.

I only started learning about turtles so I don't really know how to do it, I was thinking of something simple like making it pulse then simply sleep till i'm ready for it to pulse again?

#2 JokerRH

  • Members
  • 147 posts

Posted 17 April 2013 - 08:37 PM

 Tyken132, on 17 April 2013 - 07:40 PM, said:

I was thinking of something simple like making it pulse then simply sleep till i'm ready for it to pulse again?

That's probably the best solution :D

#3 Tyken132

  • Members
  • 3 posts

Posted 17 April 2013 - 11:09 PM

 JokerRH, on 17 April 2013 - 08:37 PM, said:

That's probably the best solution :D

I figured something like that would work. How would I go about writing the code to do that? I'm new to coding, let alone computercraft.

#4 Herû

  • Members
  • 18 posts
  • LocationNorway

Posted 17 April 2013 - 11:30 PM

 Tyken132, on 17 April 2013 - 11:09 PM, said:

 JokerRH, on 17 April 2013 - 08:37 PM, said:

That's probably the best solution :D

I figured something like that would work. How would I go about writing the code to do that? I'm new to coding, let alone computercraft.
For one hour:
while true do
-- Code to do it here --
sleep(3600)
end


#5 LNETeam

  • Members
  • 111 posts
  • LocationEclipse

Posted 18 April 2013 - 12:22 AM

 Herû, on 17 April 2013 - 11:30 PM, said:

 Tyken132, on 17 April 2013 - 11:09 PM, said:

 JokerRH, on 17 April 2013 - 08:37 PM, said:

That's probably the best solution :D

I figured something like that would work. How would I go about writing the code to do that? I'm new to coding, let alone computercraft.
For one hour:
while true do
-- Code to do it here --
sleep(3600)
end
That would probably be the best way to go about that. I've used the same thing your are trying to do, and mine was basically that same as this

#6 TheOddByte

    Lazy Coder

  • Members
  • 1,607 posts
  • LocationSweden

Posted 18 April 2013 - 10:36 AM

 cube123, on 18 April 2013 - 12:22 AM, said:

 Herû, on 17 April 2013 - 11:30 PM, said:

 Tyken132, on 17 April 2013 - 11:09 PM, said:

 JokerRH, on 17 April 2013 - 08:37 PM, said:

That's probably the best solution :D

I figured something like that would work. How would I go about writing the code to do that? I'm new to coding, let alone computercraft.
For one hour:
while true do
-- Code to do it here --
sleep(3600)
end
That would probably be the best way to go about that. I've used the same thing your are trying to do, and mine was basically that same as this
So.. What are you trying to set redstone true one one side every hour then shut it off?
If so then this is pretty much same as Herûs code but with the redstone stuff too..
while true do
sleep(3600)
rs.setOutput("right", true) --Change to the side your using
sleep(1)
rs.setOutput("right",false) --Same here, Change right to the side you are using..
end

And here is one for if you want to see how long it is until it does it again..
Spoiler
Hope any of this helped! ;)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users