This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
The_Locust911's profile picture

Kick-start the clock

Started by The_Locust911, 10 November 2012 - 10:12 AM
The_Locust911 #1
Posted 10 November 2012 - 11:12 AM
I want to use a computer to start a redstone clock, that means I need the pulse to last for far less than a second. would I use: "sleep( .25 );" or something to do less than a second?
Doyle3694 #2
Posted 10 November 2012 - 11:33 AM
yeah. a note is that if you have less then 0.05 seconds delay you will lose pulses
ElvishJerricco #3
Posted 10 November 2012 - 01:53 PM
The Minecraft world updates 20 times a second. This implies "ticks" which are each 1/20 seconds long where the world updates. So you're computer can turn the signal on for one of those ticks, and turn it off in the other.

rs.setOutput("side", true)
sleep(1/20) -- make the redstone remain on for a whole tick
rs.setOutput("side", false)
sleep(1/20) -- make sure nothing changes the redstone for the next tick so that you ensure it remains off.

Also, people often say a redstone tick is 0.1 seconds. This is only because it takes two world ticks to generate the pulse. One on, one off. And 1/20 + 1/20 = 0.1
Cruor #4
Posted 10 November 2012 - 03:49 PM
Programs is for released code only, moved to ask a pro.
The_Locust911 #5
Posted 11 November 2012 - 03:56 AM
thank you very much, everything is working great. :unsure:/>/>