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

redstone clock

Started by mattinator123, 24 October 2012 - 12:20 AM
mattinator123 #1
Posted 24 October 2012 - 02:20 AM
i was bored one day and decided to waste my time and make a giant clock that keeps perfect minecraft time. (without lag it will)

it is a little complicated to hook up.
———————————————————————————|/
you need 8 computers plus one for the colon in the middle of HH : MM

its in a zip because there are 9 files and one folder (because i like to keep things neat and orderly)

if you look at any of the files with a one you will see the following:


--[[
(1)> ----   <(1)
2> |	|  <(3)
2> |	|  <(3)
(4)> ----   <(4)
5> |	|  <(6)
5> |	|  <(6)
7>  ----   <7
sides:
left=1
right=3
back=4
front=6
]]
and any one with a 2 you will see this:

--[[
1>   ----   <1
(2)> |	|  <3
(2)> |	|  <3
4>   ----   <4
(5)> |	|  <6
(5)> |	|  <6
(7)>  ----   <(7)
sides:
left=2
right=5
back=7
--]]

for those of you confused about what file does what:


H H : M M

h10 controls the ten hours part [H] h : m m
h01 controls the one hours part h [H] : m m
m10 controls the ten mins part h h :[M] m
m01 controls the one mins part h h : m [M]
*20 and *02 are the extended parts of *10 and *01
for example:
m20 extends m10
i think blinker is pretty strait forward
i hope you understand now if not ask what you don't know

Tips:
-Those will help you GREATLY to make your giant clock work so i suggest you study them closely!

-I would use this on a server. (much better than a golden clock)

-I also suggest using wireless redstone. (if available)


I'm a noob lua scripter and only in grade 9 so any way to make these less clutterfull will be very helpfull


screenshots are in the downloads section because im a noob and dont know how to put them
[here]

comment are welcome and thanks for checking this out (even if you didn't download)
if i forgot anything just ask and il respond to the best of my abilities.

(code is below for those who don't want malware but i strongly suggest downloading it as there are 9 different files)
Spoiler

blinker:
while true do
sleep(0.5)
redstone.setOutput("back", true)
sleep(0.5)
redstone.setOutput("back",false)
end

h01:--[[
(1)> ----   <(1)
2> |	|  <(3)
2> |	|  <(3)
(4)> ----   <(4)
5> |	|  <(6)
5> |	|  <(6)
7>  ----   <7
sides:
left=1
right=3
back=4
front=6
redstone.setOutput("side", true)
times
--15:00 = 15.00
--15:15 = 15.25
--15:30 = 15.50
--15:45 = 15.75...
]]
while true do
sleep(0.001)
local nTime = os.time()
local nHour = math.floor(nTime)
local nMinute = math.floor((nTime - nHour)*60)	 --time = (string.format("%d %02d", nHour, nMinute))
print(""..nHour, ":"..nMinute)

local function reset()
redstone.setOutput("left",false)
redstone.setOutput("right",false)
redstone.setOutput("front",false)
redstone.setOutput("back",false)
end
if nHour >=19 then
nHour = nHour - 20
else
if nHour >=9 then
nHour = nHour - 10
end
end
if (nHour) - 0 == 0 then --0
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("front",true)
end
if (nHour) - 1 == 0 then --1
reset()
redstone.setOutput("right",true)
redstone.setOutput("front",true)
end
if (nHour) - 2 == 0 then --2v
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("back",true)
end
if (nHour) - 3 == 0 then --3
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("back",true)
redstone.setOutput("front",true)
end
if (nHour) - 4 == 0 then --4
reset()
redstone.setOutput("right",true)
redstone.setOutput("front",true)
redstone.setOutput("back",true)
end
if (nHour) - 5 == 0 then --5
reset()
redstone.setOutput("left",true)
redstone.setOutput("front",true)
redstone.setOutput("back",true)
end
if (nHour) - 6 == 0 then --6
reset()
redstone.setOutput("left",true)
redstone.setOutput("back",true)
redstone.setOutput("front",true)
redstone.setOutput("top",true)
end
if (nHour) - 7 == 0 then --7
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("front",true)
end
if (nHour) - 8 == 0 then --8
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("front",true)
redstone.setOutput("back",true)
end
if (nHour) - 9 == 0 then --9
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("front",true)
redstone.setOutput("back",true)
end
end


h02:
--[[
1>   ----   <1
(2)> |	|  <3
(2)> |	|  <3
4>   ----   <4
(5)> |	|  <6
(5)> |	|  <6
(7)>  ----   <(7)
sides:
left=2
right=5
back=7
--]]
while true do
sleep(0.001)
local nTime = os.time()
local nHour = math.floor(nTime)
local nMinute = math.floor((nTime - nHour)*60)

local function reset()
redstone.setOutput("left",false)
redstone.setOutput("right",false)
redstone.setOutput("front",false)
redstone.setOutput("back",false)
end
if nHour >=19 then
nHour = nHour - 20
else
if nHour >=9 then
nHour = nHour - 10
end
end
if (nHour) - 0 == 0 then --0
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("back",true)
end
if (nHour) - 1 == 0 then --7
reset()
end
if (nHour) - 2 == 0 then --2
reset()
redstone.setOutput("right",true)
redstone.setOutput("back",true)
end
if (nHour) - 3 == 0 then --3
reset()
redstone.setOutput("back",true)
end
if (nHour) - 4 == 0 then --4
reset()
redstone.setOutput("left",true)
end
if (nHour) - 5 == 0 then --5
reset()
redstone.setOutput("left",true)
redstone.setOutput("back",true)
end
if (nHour) - 6 == 0 then --6

reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("back",true)
end
if (nHour) - 7 == 0 then --7
reset()
end
if (nHour) - 8 == 0 then --8
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("back",true)
end
if (nHour) - 9 == 0 then --9
reset()
redstone.setOutput("left",true)
end
end

h10:
--[[
(1)> ----   <(1)
2> |	|  <(3)
2> |	|  <(3)
(4)> ----   <(4)
5> |	|  <(6)
5> |	|  <(6)
7>  ----   <7
sides:
left=1
right=3
back=4
front=6
times
--15:00 = 15.00
--15:15 = 15.25
--15:30 = 15.50
--15:45 = 15.75...
]]
while true do
sleep(0.001)
local nTime = os.time()
local nHour = math.floor(nTime)
local nMinute = math.floor((nTime - nHour)*60)
print(""..nHour, ":"..nMinute)
nHour = math.floor(nHour/10)

local function reset()
redstone.setOutput("left",false)
redstone.setOutput("right",false)
redstone.setOutput("front",false)
redstone.setOutput("back",false)
end
if (nHour) - 0 == 0 then --0
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("front",true)
end
if (nHour) - 1 == 0 then --1
reset()
redstone.setOutput("right",true)
redstone.setOutput("front",true)
end
if (nHour) - 2 == 0 then --2
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("back",true)
end
if (nHour) - 3 == 0 then --3
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("back",true)
redstone.setOutput("front",true)
end
if (nHour) - 4 == 0 then --4
reset()
redstone.setOutput("right",true)
redstone.setOutput("front",true)
redstone.setOutput("back",true)
end
if (nHour) - 5 == 0 then --5
reset()
redstone.setOutput("left",true)
redstone.setOutput("front",true)
redstone.setOutput("back",true)
end
if (nHour) - 6 == 0 then --6
reset()
redstone.setOutput("left",true)
redstone.setOutput("back",true)
redstone.setOutput("front",true)
redstone.setOutput("top",true)
end
if (nHour) - 7 == 0 then --7
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("front",true)
end
if (nHour) - 8 == 0 then --8
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("front",true)
redstone.setOutput("back",true)
end
if (nHour) - 9 == 0 then --9
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("front",true)
redstone.setOutput("back",true)
end
end

h20:
--[[
1>   ----   <1
(2)> |	|  <3
(2)> |	|  <3
4>   ----   <4
(5)> |	|  <6
(5)> |	|  <6
(7)>  ----   <(7)
sides:
left=2
right=5
back=7
redstone.setOutput("side", true)
--]]
while true do
sleep(0.001)
local nTime = os.time()
local nHour = math.floor(nTime)
local nMinute = math.floor((nTime - nHour)*60)
nHour = math.floor(nHour/10)

local function reset()
redstone.setOutput("left",false)
redstone.setOutput("right",false)
redstone.setOutput("front",false)
redstone.setOutput("back",false)
end
if nHour >=9 then
nHour = nHour - 10
endif (nHour) - 0 == 0 then --0
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("back",true)
end
if (nHour) - 1 == 0 then --7
reset()
end
if (nHour) - 2 == 0 then --2
reset()
redstone.setOutput("right",true)
redstone.setOutput("back",true)
end
if (nHour) - 3 == 0 then --3
reset()
redstone.setOutput("back",true)
end
if (nHour) - 4 == 0 then --4
reset()
redstone.setOutput("left",true)
end
if (nHour) - 5 == 0 then --5
reset()
redstone.setOutput("left",true)
redstone.setOutput("back",true)
end
if (nHour) - 6 == 0 then --6
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("back",true)
end
if (nHour) - 7 == 0 then --7
reset()
end
if (nHour) - 8 == 0 then --8
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("back",true)
end
if (nHour) - 9 == 0 then --9
reset()
redstone.setOutput("left",true)
end
end

m01:
--[[
(1)> ----   <(1)
2> |	|  <(3)
2> |	|  <(3)
(4)> ----   <(4)
5> |	|  <(6)
5> |	|  <(6)
7>  ----   <7
sides:
left=1
right=3
back=4
front=6
times
--15:00 = 15.00
--15:15 = 15.25
--15:30 = 15.50
--15:45 = 15.75...
]]
while true do
sleep(0.001)
local nTime = os.time()
local nHour = math.floor(nTime)
local nMinute = math.floor((nTime - nHour)*60)

local function reset()
redstone.setOutput("left",false)
redstone.setOutput("right",false)
redstone.setOutput("front",false)
redstone.setOutput("back",false)
end
if nMinute >= 50 then
nMinute = nMinute - 50
else
if nMinute >= 40 then
nMinute = nMinute - 40
else
if nMinute >= 30 then
nMinute = nMinute - 30
else
if nMinute >= 20 then
nMinute = nMinute - 20
else
if nMinute >= 10 then
nMinute = nMinute - 10
end
end
end
end
endif (nMinute) - 0 == 0 then --0

reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("front",true)
end
if (nMinute) - 1 == 0 then --1
reset()
redstone.setOutput("right",true)
redstone.setOutput("front",true)
end
if (nMinute) - 2 == 0 then --2
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("back",true)
end
if (nMinute) - 3 == 0 then --3
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("back",true)
redstone.setOutput("front",true)
end
if (nMinute) - 4 == 0 then --4
reset()
redstone.setOutput("right",true)
redstone.setOutput("front",true)
redstone.setOutput("back",true)
end
if (nMinute) - 5 == 0 then --5
reset()
redstone.setOutput("left",true)
redstone.setOutput("front",true)
redstone.setOutput("back",true)
end
if (nMinute) - 6 == 0 then --6
reset()
redstone.setOutput("left",true)
redstone.setOutput("back",true)
redstone.setOutput("front",true)
redstone.setOutput("top",true)
end
if (nMinute) - 7 == 0 then --7
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("front",true)
end
if (nMinute) - 8 == 0 then --8
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("front",true)
redstone.setOutput("back",true)
end
if (nMinute) - 9 == 0 then --9
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("front",true)
redstone.setOutput("back",true)
end
end

m02:
--[[
1>   ----   <1
(2)> |	|  <3
(2)> |	|  <3
4>   ----   <4
(5)> |	|  <6
(5)> |	|  <6
(7)>  ----   <(7)
sides:
left=2
right=5
back=7
redstone.setOutput("side", true)
--]]
while true do
sleep(0.001)
local nTime = os.time()
local nHour = math.floor(nTime)
local nMinute = math.floor((nTime - nHour)*60)

local function reset()
redstone.setOutput("left",false)
redstone.setOutput("right",false)
redstone.setOutput("front",false)
redstone.setOutput("back",false)
end
if nMinute >= 50 then
nMinute = nMinute - 50
else
if nMinute >= 40 then
nMinute = nMinute - 40
else
if nMinute >= 30 then
nMinute = nMinute - 30
else
if nMinute >= 20 then
nMinute = nMinute - 20
else
if nMinute >= 10 then
nMinute = nMinute - 10
end
end
end
end
end
if (nMinute) - 0 == 0 then --0
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("back",true)
end
if (nMinute) - 1 == 0 then --7
reset()
if (nMinute) - 2 == 0 then --2
reset()
redstone.setOutput("right",true)
redstone.setOutput("back",true)
end
if (nMinute) - 3 == 0 then --3
reset()
redstone.setOutput("back",true)
end
if (nMinute) - 4 == 0 then --4
reset()
redstone.setOutput("left",true)
end
if (nMinute) - 5 == 0 then --5
reset()
redstone.setOutput("left",true)
redstone.setOutput("back",true)
end
if (nMinute) - 6 == 0 then --6
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("back",true)
end
if (nMinute) - 7 == 0 then --7
reset()
end
if (nMinute) - 8 == 0 then --8
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("back",true)
end
if (nMinute) - 9 == 0 then --9
reset()
redstone.setOutput("left",true)
end
end

m10:
--[[
(1)> ----   <(1)
2> |	|  <(3)
2> |	|  <(3)
(4)> ----   <(4)
5> |	|  <(6)
5> |	|  <(6)
7>  ----   <7
sides:
left=1
right=3
back=4
front=6
times
--15:00 = 15.00
--15:15 = 15.25
--15:30 = 15.50
--15:45 = 15.75...
]]
while true do
sleep(0.001)
local nTime = os.time()
local nHour = math.floor(nTime)
local nMinute = math.floor((nTime - nHour)*60)
nMinute = math.floor((nMinute)/10)

local function reset()
redstone.setOutput("left",false)
redstone.setOutput("right",false)
redstone.setOutput("front",false)
redstone.setOutput("back",false)
end
if (nMinute) - 0 <= 0 then --0
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("front",true)
end
if (nMinute) - 1 == 0 then --1
reset()
redstone.setOutput("right",true)
redstone.setOutput("front",true)
end
if (nMinute) - 2 == 0 then --2
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("back",true)
end
if (nMinute) - 3 == 0 then --3
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("back",true)
redstone.setOutput("front",true)
end
if (nMinute) - 4 == 0 then --4
reset()
redstone.setOutput("right",true)
redstone.setOutput("front",true)
redstone.setOutput("back",true)
end
if (nMinute) - 5 == 0 then --5
reset()
redstone.setOutput("left",true)
redstone.setOutput("front",true)
redstone.setOutput("back",true)
end
if (nMinute) - 6 == 0 then --6
reset()
redstone.setOutput("left",true)
redstone.setOutput("back",true)
redstone.setOutput("front",true)
redstone.setOutput("top",true)
end
if (nMinute) - 7 == 0 then --7
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("front",true)
end
if (nMinute) - 8 == 0 then --8
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("front",true)
redstone.setOutput("back",true)
end
if (nMinute) - 9 == 0 then --9
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("front",true)
redstone.setOutput("back",true)
end
end

m20:
--[[
1>   ----   <1
(2)> |	|  <3
(2)> |	|  <3
4>   ----   <4
(5)> |	|  <6
(5)> |	|  <6
(7)>  ----   <(7)
sides:
left=2
right=5
back=7
--]]
while true do
sleep(0.001)
local nTime = os.time()
local nHour = math.floor(nTime)
local nMinute = math.floor((nTime - nHour)*60)
nMinute = math.floor(nMinute/10)

local function reset()
redstone.setOutput("left",false)
redstone.setOutput("right",false)
redstone.setOutput("front",false)
redstone.setOutput("back",false)
end
if (nMinute) - 0 == 0 then --0
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("back",true)
end
if (nMinute) - 1 == 0 then --1
reset()
end
if (nMinute) - 2 == 0 then --2
reset()
redstone.setOutput("right",true)
redstone.setOutput("back",true)
end
if (nMinute) - 3 == 0 then --3
reset()
redstone.setOutput("back",true)
end
if (nMinute) - 4 == 0 then --4
reset()
redstone.setOutput("left",true)
end
if (nMinute) - 5 == 0 then --5
reset()
redstone.setOutput("left",true)
redstone.setOutput("back",true)
end
if (nMinute) - 6 == 0 then --6
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("back",true)
end
if (nMinute) - 7 == 0 then --7
reset()
end
if (nMinute) - 8 == 0 then --8
reset()
redstone.setOutput("left",true)
redstone.setOutput("right",true)
redstone.setOutput("back",true)
end
if (nMinute) - 9 == 0 then --9
reset()
redstone.setOutput("left",true)
end
end
mattinator123 #2
Posted 24 October 2012 - 03:51 AM
crap forgot to say you need to run the clock program before typing in h10 or h01 or whatever.(when using the zip)
ChunLing #3
Posted 24 October 2012 - 03:53 AM
…that is some pretty crazy giant clock building there.
PixelToast #4
Posted 24 October 2012 - 03:53 AM
oh god please compress it with tables and math D:
ChunLing #5
Posted 24 October 2012 - 03:55 AM
That will compress it some but there are 9 different programs here, each only displaying part of a digit. It's wack.
mattinator123 #6
Posted 24 October 2012 - 04:21 AM
but it works

-just made it smaller by adding a reset function

not much smaller but its something
mattinator123 #7
Posted 24 October 2012 - 04:46 AM
oh god please compress it with tables and math D:

do you think you could help me with that? (im only really good at batch files) i still don't even know C++
Heracles421 #8
Posted 24 October 2012 - 04:53 AM
For God's sake, use spoilers, they don't hurt and they make the thread look neater
SpoilerLike this

And you just need 4 files
Edit: Three if you use the same file for the first and third digit
Edit2: Why don't you use a screen?
mattinator123 #9
Posted 24 October 2012 - 05:08 AM
For God's sake, use spoilers, they don't hurt and they make the thread look neater
SpoilerLike this

And you just need 4 files
Edit: Three if you use the same file for the first and third digit
Edit2: Why don't you use a screen?

thanks i will (i thought quotes and codes did that too but i guess not)
mattinator123 #10
Posted 24 October 2012 - 05:10 AM
For God's sake, use spoilers, they don't hurt and they make the thread look neater
SpoilerLike this

And you just need 4 files
Edit: Three if you use the same file for the first and third digit
Edit2: Why don't you use a screen?

screens wont work because the font is tiny and im too lazy to change it.
mattinator123 #11
Posted 24 October 2012 - 05:14 AM
For God's sake, use spoilers, they don't hurt and they make the thread look neater
SpoilerLike this

And you just need 4 files
Edit: Three if you use the same file for the first and third digit
Edit2: Why don't you use a screen?

screens wont work because the font is tiny and im too lazy to change it.

so i built a giant clock and made 9 programs instead
mattinator123 #12
Posted 24 October 2012 - 05:18 AM
can i get a like for effort?
ChunLing #13
Posted 24 October 2012 - 08:56 AM
I like it. But you should know that you can make monitor text really big, if that's the only reason you're doing this. I just thought it was so ludicrously awsome to see the giant LED looking clock with 9 computers powering it.
Heracles421 #14
Posted 24 October 2012 - 12:58 PM
Well, let me work on this and I'll PM you with a better example of how to use this.
About the monitor, you can resize the text. If you want to do this PM me and I'll show you how to do it
mattinator123 #15
Posted 25 October 2012 - 12:39 AM
Well, let me work on this and I'll PM you with a better example of how to use this.
About the monitor, you can resize the text. If you want to do this PM me and I'll show you how to do it

i don't want you waisting your time on someone like me unless you really want to
Heracles421 #16
Posted 25 October 2012 - 12:44 AM
Well, let me work on this and I'll PM you with a better example of how to use this.
About the monitor, you can resize the text. If you want to do this PM me and I'll show you how to do it

i don't want you waisting your time on someone like me unless you really want to
Well, I don't have anything else to do, apart from my turtle remote
remiX #17
Posted 25 October 2012 - 08:34 PM
How long did this take u O_o
mattinator123 #18
Posted 09 November 2012 - 02:53 PM
How long did this take u O_o

it took about 6 hours
but it was my first lua project