LCDproc development and user support list

Text archives Help


[Lcdproc] Clients for dummies!


Chronological Thread 
  • From: epooch at cox.net (epooch at cox.net)
  • Subject: [Lcdproc] Clients for dummies!
  • Date: Thu, 13 Nov 2008 17:11:34 -0800

You can use an expect script to control a telnet session to make a very
simple client using the title and message as arguments :
----
#!/usr/bin/expect -f
# Sample telnet to LCDproc automation
## call with /path/to/script "Title" "Message"

spawn telnet localhost 13666

expect "Connected" {
send "hello\n"
expect "connect"

expect -re "lcd wid (.*) hgt (.*) cellwid"
set screen_wid $expect_out(1,string)
set screen_hgt $expect_out(2,string)

send "screen_add myscreen\n"

send "widget_add myscreen title1 title\n"
send "widget_set myscreen title1 {[lindex $argv 0]}\n"

send "widget_add myscreen scroller2 scroller\n"
send "widget_set myscreen scroller2 1 2 $screen_wid 1 m 3 {[lindex $argv
1]}\n"
}
exit

---
I haven't really tested that, but it should work.

---- Andrew Grover <andy.grover at gmail.com> wrote:
> On Thu, Nov 13, 2008 at 2:01 PM, <hansfong at zonnet.nl> wrote:
> > I got a picoLCD 4x20, which works fine with LCDproc and the example perl
> > scripts which came with it. My aim is to understand the workings of this
> > type of hardware, but I'm no programmer by any means apart from some
> > bash/php experience.
> >
> > I looked at the perl scripts, but they are a bit hard to comprehend and
> > alter to my own needs. So my questions:
> > - Is there a beginners guide for writing clients for LCDproc? - Or maybe a
> > template on which I can build my own client or study the workings of the
> > code? - Can a client be written as a simple shell script, or php script
> > called from the command line?
>
> Look at the LCDd manpage. The client protocol is human-readable, so
> you can use whatever language you want to telnet to localhost port
> 13666 and send commands.
>
> You might also want to check out the source of some other languages'
> wrapper libraries, if you don't like Perl:
> Ruby: http://sourceforge.net/projects/lcdproc-ruby/
> Ruby: http://sourceforge.net/projects/ruby-lcd/
>
> These both include clients written to demonstrate the use of the library.
>
> I'm also working on a Python lib, see here:
> http://github.com/agrover/pylcd/tree/master
> (it's not really ready for primetime, but take a look if you want.)
>
> > Right now my preferred next step is to just get some own text displayed on
> > the screen, e.g. open a text file and send the contents to the display and
> > then move on to more complex things. Any help is very much appreciated.
>
> telnet localhost 13666
> hello
> screen_add myscreen
> widget_add myscreen mywidget string
> widget_set myscreen 1 1 {hello world!}
>
> Regards -- Andy
> _______________________________________________
> LCDproc mailing list
> LCDproc at lists.omnipotent.net
> http://lists.omnipotent.net/mailman/listinfo/lcdproc





Archive powered by MHonArc 2.6.18.

Top of page