As my first thread on FP, I've decided to release this module i made for a test one day because i got a free HP Laserjet 4200.
[thumb]http://img7.imagebanana.com/img/j3xbvn9o/img674.jpg[/thumb]
[lua]
if not laserjet then
require("laserjet")
laserjet.SetWidth(20,4) --20x4 LCD (20 chars/line, 4 lines), change if you have a different LCD
laserjet.IPAddress("192.168.0.20")
end
function laserjet.SetText(what)
if type(what) == "string" then
what = string.Explode("\n", what)
end
local New = ""
for k,v in ipairs(what) do
New = New..v..string.rep(" ", (laserjet.GetWide() - #v) ) --Width of LCD, set before
end
return #New, laserjet.WriteString(New) --Raw WriteString, no formatting
end
laserjet.SetText("This string is\nOn two lines!") --String to display, will auto-fit to the screen
local Buff = {
"Players: 4/8",
"Map: asc_snipe_crazy",
"Wep: BOOMSTICK!",
"Kills: 688",
}
local New,Bytes = laserjet.SetText(Buff) --Or table!
if Bytes then --Total bytes in the packet
print("! sending: "..#New.." chars ("..Bytes.." bytes)")
else
print("! error :(")
end
print( laserjet.GetValue() ) --Current message on the LCD
[/lua]
Download (source included)
[url]http://www.multiupload.com/ECY9EN84DL[/url]
You never stop fucking around with all the LCD screens you get do you? This is amazing :D
Yeah.. nobody have this printer.. :P
Please make one for Arduino :D
Any other printer compatibly with this?
[QUOTE=benjojo;34198114]Any other printer compatibly with this?[/QUOTE]
I only have the Laserjet, but it should work with all printers that support HP's [url=http://en.wikipedia.org/wiki/Printer_Job_Language]PJL[/url]
Sorry, you need to Log In to post a reply to this thread.