Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Each turtle program is assigned a uniqe color then the turtles are placed in a circle
- -- increases clockwise according to the following color list
- --1 = white
- --2 = orange
- --4 = magenta
- --8 = lightBlue0
- --16 = yellow
- --32 = lime
- --64 = pink
- --128 = gray
- --256 = lightGray
- --512 = cyan
- --1024 = purple
- --2048 = blue
- --4096 = brown
- --8192 = green
- --16384 = red
- --32768 = black
- peds = {false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false}
- pedposx = {4, 6, 7, 8, 10, 10, 10, 10, 10, 8, 7, 6, 4, 4, 4, 4 }
- pedposy = {2, 2, 2, 2, 2, 4, 5, 6, 8, 8, 8, 8, 8, 6, 5, 4 }
- mon = peripheral.wrap("left")
- reds = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768}
- mon.setBackgroundColor(colors.blue)
- mon.setTextScale(2)
- mon.clear()
- function monreset()
- mon.setBackgroundColor(colors.blue)
- mon.clear()
- mon.setTextColor(colors.white)
- mon.setCursorPos(4, 9)
- mon.write("Pedestal")
- mon.setCursorPos(4, 10)
- mon.write("Selector")
- mon.setCursorPos(12, 1)
- mon.write("Presets")
- mon.setBackgroundColor(colors.purple)
- mon.setCursorPos(5, 3)
- mon.write(" ")
- mon.setBackgroundColor(colors.blue)
- end
- function setReds()
- rstotal = 0
- for i=1,16 do
- if (peds[i]) then
- rstotal = rstotal + reds[i]
- end
- end
- rs.setBundledOutput("bottom", rstotal)
- end
- function resetPeds()
- for i=1, 16 do
- peds[i] = false
- end
- end
- function checkClick()
- event, side, xPos, yPos = os.pullEvent("monitor_touch")
- for i=1,16 do
- if (xPos == pedposx[i]) then
- if (yPos == pedposy[i]) then
- if (peds[i] == true) then
- peds[i] = false
- else
- peds[i] = true
- end
- end
- end
- end
- if (xPos > 13) then
- if (xPos < 19) then
- if (yPos == 2) then
- resetPeds()
- peds[1] = true
- peds[9] = true
- end
- if (yPos == 3) then
- resetPeds()
- peds[3] = true
- peds[9] = true
- peds[13] = true
- end
- if (yPos == 4) then
- resetPeds()
- peds[3] = true
- peds[7] = true
- peds[11] = true
- peds[15] = true
- end
- if (yPos == 5) then
- resetPeds()
- peds[7] = true
- peds[4] = true
- peds[11] = true
- peds[1] = true
- peds[14] = true
- end
- if (yPos == 6) then
- resetPeds()
- peds[1] = true
- peds[4] = true
- peds[6] = true
- peds[9] = true
- peds[12] = true
- peds[14] = true
- end
- if (yPos == 7) then
- resetPeds()
- peds[1] = true
- peds[3] = true
- peds[5] = true
- peds[8] = true
- peds[10] = true
- peds[13] = true
- peds[15] = true
- end
- if (yPos == 8) then
- resetPeds()
- peds[1] = true
- peds[3] = true
- peds[5] = true
- peds[7] = true
- peds[9] = true
- peds[11] = true
- peds[13] = true
- peds[15] = true
- end
- if (yPos == 10) then
- resetPeds()
- end
- end
- end
- end
- function showPeds()
- for i=1,16 do
- mon.setCursorPos(pedposx[i], pedposy[i])
- if (peds[i] == true) then
- mon.setBackgroundColor(colors.lime)
- mon.write(" ")
- else
- mon.setBackgroundColor(colors.black)
- mon.write(" ")
- end
- end
- end
- function showPresets()
- mon.setBackgroundColor(colors.blue)
- mon.setCursorPos(14, 2)
- mon.write("Two")
- mon.setCursorPos(14, 3)
- mon.write("Three")
- mon.setCursorPos(14, 4)
- mon.write("Four")
- mon.setCursorPos(14, 5)
- mon.write("Five")
- mon.setCursorPos(14, 6)
- mon.write("Six")
- mon.setCursorPos(14, 7)
- mon.write("Seven")
- mon.setCursorPos(14, 8)
- mon.write("Eight")
- mon.setCursorPos(14, 10)
- mon.write("Reset")
- end
- while true do
- monreset()
- setReds()
- showPeds()
- showPresets()
- checkClick()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement