View difference between Paste ID: ZVQJ8wbd and VduFpWZ3
SHOW: | | - or go back to the newest paste.
1
--giant clock--
2
local sSide = {
3
"left",
4
"right",
5
"top",
6
"bottom",
7
"back",
8
"front"
9
}
10
--peripheral check
11
for i=1,#sSide do
12
if peripheral.isPresent(sSide[i]) then
13
	if peripheral.getType(sSide[i]) == "monitor" then mon = peripheral.wrap(sSide[i])
14
	elseif peripheral.getType(sSide[i])==nil then
15
		error("No peripheral attached")
16
	end
17
end
18
end
19
--variables
20
local digits = {}
21
digits[0]={"   ___  ",
22
 "  / _ \\ ",
23
 " | | | |",
24
 " | | | |",
25
 " | |_| |",
26
 "  \\___/ "}
27
digits[1]={"   __   ",
28
 "  /_ |  ",
29
 "   | |  ",
30
 "   | |  ",
31
 "   | |  ",
32
 "   |_|  "}
33
digits[2]={"  ___   ",
34
 " |__ \\  ",
35
 "    ) | ",
36
 "   / /  ",
37
 "  / /_  ",
38
 " |____| "}
39
digits[3]={"  ____  ",
40
 " |___ \\ ",
41
 "   __) |",
42
 "  |__ < ",
43
 "  ___) |",
44
 " |____/ "}
45
digits[4]={" _  _   ",
46
 "| || |  ",
47
 "| || |_ ",
48
 "|__   _|",
49
 "   | |  ",
50
 "   |_|  "}
51
digits[5]={"  _____ ",
52
 " | ____|",
53
 " | |__  ",
54
 " |___ \\ ",
55
 "  ___) |",
56
 " |____/ "}
57
digits[6]={"    __  ",
58
 "   / /  ",
59
 "  / /_  ",
60
 " | '_ \\ ",
61
 " | (_) |",
62
 "  \\___/ "}
63
digits[7]={" ______ ",
64
 "|____  |",
65
 "    / / ",
66
 "   / /  ",
67
 "  / /   ",
68
 " /_/    "}
69
digits[8]={"   ___  ",
70
 "  / _ \\ ",
71
 " | (_) |",
72
 "  > _ < ",
73
 " | (_) |",
74
 "  \\___/ "}
75
digits[9]={"   ___  ",
76
 "  / _ \\ ",
77
 " | (_) |",
78
 "  \\__, |",
79
 "    / / ",
80
 "   /_/  "}
81
digits[10]={"   ___  ",
82
 "  / _ \\ ",
83
 " | | | |",
84
 " | | | |",
85
 " | |_| |",
86
 "  \\___/ "}
87
digits[11]={"   __   ",
88
 "  /_ |  ",
89
 "   | |  ",
90
 "   | |  ",
91
 "   | |  ",
92
 "   |_|  "}
93
digits[12]={"  ___   ",
94
 " |__ \\  ",
95
 "    ) | ",
96
 "   / /  ",
97
 "  / /_  ",
98
 " |____| "}
99
local colon = {
100
 "   ",
101
 " _ ",
102
 "(_)",
103
 "   ",
104
 " _ ",
105
 "(_)"
106
}
107
local am = {
108-
"     ___       ___  ___  ",
108+
"     ___        ",
109-
"    /   \\     |   \\/   | ",
109+
"    /   \\      ",
110-
"   /  ^  \\    |  \\  /  | ",
110+
"   /  ^  \\     ",
111-
"  /  /_\\  \\   |  |\\/|  | ",
111+
"  /  /_\\  \\   ",
112-
" /  _____  \\  |  |  |  | ",
112+
" /  _____  \\   ",
113-
"/__/     \\__\\ |__|  |__| "
113+
"/__/     \\__\\ "
114
}
115
local pm = {
116-
" ______    ___  ___  ",
116+
" ______    ",
117-
"|   _  \\  |   \\/   | ",
117+
"|   _  \\  ",
118-
"|  |_)  | |  \\  /  | ",
118+
"|  |_)  |  ",
119-
"|   ___/  |  |\\/|  | ",
119+
"|   ___/   ",
120-
"|  |      |  |  |  | ",
120+
"|  |       ",
121-
"|__|      |__|  |__| "
121+
"|__|       "
122
}
123
--functions
124
function digits12(h,m)
125
mon.clear()
126
--hours
127
if h == 0 then
128
	for i = 1,6 do
129
		mon.setCursorPos(1,i)
130
		mon.write(digits[1][i])
131
		mon.setCursorPos(11,i)
132
		mon.write(digits[2][i])
133
	end
134
elseif h < 12 then
135
	if h < 10 and h >= 1 then
136
		for i = 1,6 do
137
			mon.setCursorPos(1,i)
138
			mon.write(digits[0][i])
139
			mon.setCursorPos(11,i)
140
			mon.write(digits[h][i])
141
		end
142
	elseif h >= 10 and h < 20 then
143
		for i = 1,6 do
144
			mon.setCursorPos(1,i)
145
			mon.write(digits[1][i])
146
			mon.setCursorPos(11,i)
147
			mon.write(digits[h][i])
148
		end
149
	end
150
elseif h == 12 then
151
	for i = 1,6 do
152
		mon.setCursorPos(1,i)
153
		mon.write(digits[1][i])
154
		mon.setCursorPos(11,i)
155
		mon.write(digits[2][i])
156
	end
157
elseif h > 12 and h < 24 then
158
	local h = h - 12
159
	if h < 10 then
160
		mon.setCursorPos(1,1)
161
		for i = 1,6 do
162
			mon.setCursorPos(1,i)
163
			mon.write(digits[0][i])
164
			mon.setCursorPos(11,i)
165
			mon.write(digits[h][i])
166
		end
167
	elseif h >= 10 and h < 20 then
168
		for i = 1,6 do
169
			mon.setCursorPos(1,i)
170
			mon.write(digits[1][i])
171
			mon.setCursorPos(11,i)
172
			mon.write(digits[h][i])
173
		end
174
	end
175
end
176
--colon
177
for i = 1,6 do
178
	mon.setCursorPos(20,i)
179
	mon.write(colon[i])
180
end
181
--minutes
182
if m < 10 then
183
	for i = 1,6 do
184
		mon.setCursorPos(24,i)
185
		mon.write(digits[0][i])
186
		mon.setCursorPos(34,i)
187
		mon.write(digits[m][i])
188
	end
189
elseif m >=10 and m < 20 then
190
	local m = m-10
191
	for i = 1,6 do
192
		mon.setCursorPos(24,i)
193
		mon.write(digits[1][i])
194
		mon.setCursorPos(34,i)
195
		mon.write(digits[m][i])
196
	end
197
elseif m >=20 and m < 30 then
198
	local m = m-20
199
	for i = 1,6 do
200
		mon.setCursorPos(24,i)
201
		mon.write(digits[2][i])
202
		mon.setCursorPos(34,i)
203
		mon.write(digits[m][i])
204
	end
205
elseif m >=30 and m < 40 then
206
	local m = m-30
207
	for i = 1,6 do
208
		mon.setCursorPos(24,i)
209
		mon.write(digits[3][i])
210
		mon.setCursorPos(34,i)
211
		mon.write(digits[m][i])
212
	end
213
elseif m >=40 and m < 50 then
214
	local m = m-40
215
	for i = 1,6 do
216
		mon.setCursorPos(24,i)
217
		mon.write(digits[4][i])
218
		mon.setCursorPos(34,i)
219
		mon.write(digits[m][i])
220
	end
221
elseif m >=50 then
222
	local m = m-50
223
	for i = 1,6 do
224
		mon.setCursorPos(24,i)
225
		mon.write(digits[5][i])
226
		mon.setCursorPos(34,i)
227
		mon.write(digits[m][i])
228
	end
229
end
230
if h < 12 then
231
	for i = 1,6 do
232
	mon.setCursorPos(44,i)
233
	mon.write(am[i])
234
	end
235
elseif h >= 12 then
236
	for i = 1,6 do
237
	mon.setCursorPos(44,i)
238
	mon.write(pm[i])
239
	end
240
end
241
end
242
243
244
while true do
245
local MChours = math.floor(os.time())
246
local MCminutes = math.floor((os.time()-math.floor(os.time()))*60)
247
digits12(MChours,MCminutes)
248
sleep(0)
249
end