Posted 30 March 2012 - 05:36 PM
Basically,
=== Videos ===
[media]http://www.youtube.com/watch?v=iQWZJBIm8qU[/media]
Display setup and usage!
[media]http://youtu.be/-NLOhJQhnh4[/media]
=== Build Log ===
My first task was to create the font so I could determine how big the screen would need to be.
Inspiration: 16 Segment LED Displays
However 16 Segments looked to blocky for lower-case characters and symbols. The image below shows the discarded 16 segment design, and the improved 48 segment layout created just for this project.
I also discarded a 32 segment design too -.-
2 - Converting the font into lua
Each letter is a series of segment numbers as seen above, however I cba to write out all the segment numbers into arrays, so I simply made a macro in VBA to copy out the numbers of the green cells and put them into a big lua 'if' 'else' statement for each letter, this would then return an array like so:
3 - Making the first 48 segment display
[This is where the RedPower 2 Mod comes in!]
After finding a suitable place to put the display, I simply placed lamps into the shape as designed in Excel, and connected the relevant coloured wire to the relevant lamp using the colour numbers below with the leftmost design in excel:
Then… 3 bundled cables for the 3x16 segments and a computer:
The OR gate connects the brown (13) and green (14) wires with the white wire circled above, because that pixel is shared between segments 13 and 14 and should come on if either are activated.
Note: see the red and black bundled cables below the computer - this connects to the previous and next segment computer (see below).
4 - Almost Done…
Creating the program - Here is the code, look at the code under '– main' to get an idea of how it all works.
Note: displayCharacter("A") would display the letter A on the connected segment display etc.
Note: Step 6 gives an explaination on the code below regarding how the character is determined.
The Code:
5 - One more thing (or maybe 19)
Then I repeated step 2, 19 more times -.-, and copied the program to every segment pc.
Note: This design is scalable - the segments are daisy chained and the signal cable supports 65535 combinations (2 [on or off] to the power of 16 lines = 2^16), which is 500x 128 (the ascii charset) so that means: You could have any number of characters from 1 to little over 500 all running from a single bundled cable - that is, if minecraft could handle it :] …oh and not to mention you could have 6 of those cables coming from 1 computer, making a total of 3000 characters (…oh and having more of those computers.. etc), but alas - if minecraft and my actual pc would be infinitely more powerful.
Side Note: Don't try to make them all change character every second, else this
6 - The Actual Final Step, a controller PC
The controller pc will need to send a letter to each segment pc, but it is only connected to the first segment!?!
Well basically:
to send a character to the 1st segment you would send the number: 128 * 0 + character code
to send a character to the 2nd segment you would send the number: 128 * 1 + character code
to send a character to the 3rd segment you would send the number: 128 * 2 + character code
Because if the number is larger than 128, when it reaches a segment, the segment will minus 128 and pass it on to the next screen. Until eventually the number is 128 or less, then that segment will display it and will not pass anything to the next letter.
So all we need is some code like this:
Fin.
=== Downloads ===
This creation requires, Minecraft 1.2.3, ComputerCraft, All RedPower 2 modules [Prerelease 4e]
– World (includes lua) –
Just unzip into your Minecraft 'saves' folder
World 8.2 MB
Please see the videos section for a guide to setting up and using the display!
– lua –
seg48ctl
seg48
fox_font48
btw, a big thanks to Dan200 and Eloraam for these awesome mods!
=== Videos ===
Spoiler
Demo Video[media]http://www.youtube.com/watch?v=iQWZJBIm8qU[/media]
Display setup and usage!
[media]http://youtu.be/-NLOhJQhnh4[/media]
=== Build Log ===
Spoiler
1 - The FontMy first task was to create the font so I could determine how big the screen would need to be.
Inspiration: 16 Segment LED Displays
However 16 Segments looked to blocky for lower-case characters and symbols. The image below shows the discarded 16 segment design, and the improved 48 segment layout created just for this project.
I also discarded a 32 segment design too -.-
2 - Converting the font into lua
Each letter is a series of segment numbers as seen above, however I cba to write out all the segment numbers into arrays, so I simply made a macro in VBA to copy out the numbers of the green cells and put them into a big lua 'if' 'else' statement for each letter, this would then return an array like so:
function getSegmentsForCharacter(character)
if character == " " then
return {}
elseif character == "i" then
return {3,14,21,27,33,39}
elseif character == "j" then
return {3,14,21,27,33,39,42,44,47}
.. etc
3 - Making the first 48 segment display
[This is where the RedPower 2 Mod comes in!]
After finding a suitable place to put the display, I simply placed lamps into the shape as designed in Excel, and connected the relevant coloured wire to the relevant lamp using the colour numbers below with the leftmost design in excel:
Then… 3 bundled cables for the 3x16 segments and a computer:
The OR gate connects the brown (13) and green (14) wires with the white wire circled above, because that pixel is shared between segments 13 and 14 and should come on if either are activated.
Note: see the red and black bundled cables below the computer - this connects to the previous and next segment computer (see below).
4 - Almost Done…
Creating the program - Here is the code, look at the code under '– main' to get an idea of how it all works.
Note: displayCharacter("A") would display the letter A on the connected segment display etc.
Note: Step 6 gives an explaination on the code below regarding how the character is determined.
The Code:
Spoiler
-- ensure APIs are loaded
os.loadAPI("font_fox48") -- lets us use this: font_fox48.getSegmentsForCharacter(character)
-- variables
colorNumbers = {colors.white, colors.orange, colors.magenta, colors.lightBlue, colors.yellow, colors.lime, colors.pink, colors.gray, colors.lightGray, colors.cyan, colors.purple, colors.blue, colors.brown, colors.green, colors.red, colors.black}
-- functions
function clearDisplay()
redstone.setBundledOutput("right", 0)
redstone.setBundledOutput("top", 0)
redstone.setBundledOutput("back", 0)
end
function displayCharacter(character)
characterSegments = font_fox48.getSegmentsForCharacter(character)
i = table.getn(characterSegments)
if (i > 0) then
outputTop = 0 -- 1 to 16
outputMiddle = 0 -- 17 to 32
outputBottom = 0 -- 33 to 48
while i > 0 do
segment = characterSegments[i]
if (segment <= 16) then
outputTop = colors.combine(outputTop, colorNumbers[segment])
elseif (segment <= 32) then
segment = segment - 16
outputMiddle = colors.combine(outputMiddle, colorNumbers[segment])
elseif (segment <= 48) then
segment = segment - 32
outputBottom = colors.combine(outputBottom, colorNumbers[segment])
end
i = i - 1
end
redstone.setBundledOutput("right", outputTop)
redstone.setBundledOutput("top", outputMiddle)
redstone.setBundledOutput("back", outputBottom)
else
clearDisplay()
end
end
-- main
lastInput = 0
while true do
input = redstone.getBundledInput("bottom")
if lastInput ~= input then
lastInput = input
if input == 0 then
clearDisplay()
redstone.setBundledOutput("left", 0)
elseif input <= 128 then
displayCharacter(string.char(input))
else
redstone.setBundledOutput("left", input - 128)
end
end
sleep(0.2)
end
5 - One more thing (or maybe 19)
Then I repeated step 2, 19 more times -.-, and copied the program to every segment pc.
Note: This design is scalable - the segments are daisy chained and the signal cable supports 65535 combinations (2 [on or off] to the power of 16 lines = 2^16), which is 500x 128 (the ascii charset) so that means: You could have any number of characters from 1 to little over 500 all running from a single bundled cable - that is, if minecraft could handle it :] …oh and not to mention you could have 6 of those cables coming from 1 computer, making a total of 3000 characters (…oh and having more of those computers.. etc), but alas - if minecraft and my actual pc would be infinitely more powerful.
Side Note: Don't try to make them all change character every second, else this
6 - The Actual Final Step, a controller PC
The controller pc will need to send a letter to each segment pc, but it is only connected to the first segment!?!
Well basically:
to send a character to the 1st segment you would send the number: 128 * 0 + character code
to send a character to the 2nd segment you would send the number: 128 * 1 + character code
to send a character to the 3rd segment you would send the number: 128 * 2 + character code
Because if the number is larger than 128, when it reaches a segment, the segment will minus 128 and pass it on to the next screen. Until eventually the number is 128 or less, then that segment will display it and will not pass anything to the next letter.
So all we need is some code like this:
input = ""
while input ~= "quitme" do
print ("Text to display: ")
print ("|------------------|") -- 20 characters guide (messages longer than this line will be cut off at the end)
input = io.read()
if input ~= nil then -- probably a pointless check for nil, ah well
i = 0
while i < string.len(input) do
char = string.byte(input, i + 1)
print(i)
char = char + (i * 128)
redstone.setBundledOutput("back", char)
sleep(0.3) -- ensure this is the same (or slightly longer for safety) than the segment tick rate.
i = i + 1
end
end
end
Fin.
=== Downloads ===
This creation requires, Minecraft 1.2.3, ComputerCraft, All RedPower 2 modules [Prerelease 4e]
– World (includes lua) –
Just unzip into your Minecraft 'saves' folder
World 8.2 MB
Please see the videos section for a guide to setting up and using the display!
– lua –
seg48ctl
seg48
fox_font48
btw, a big thanks to Dan200 and Eloraam for these awesome mods!