Power & Source of Big Ideas

LCD2USB two function keys how?

Moderators: chensy, FATechsupport

Hi I got the LCD2USB and it's working good showing the IP and time.

But on the wiki it says "It has two function keys which can be configured by users." but it don't say how.

Any one know how to make it use the 2 keys on it. I guess to show some other display and then maybe safely shut it down too. Something like that.

-Raymond Day
On this web page it says a one line about the buttons but does not show how that I can see. The one line says this:

Also two detectable input buttons, generally called key-a and key-b on board.


I think it be neat to press one of the buttons to change the display to something else.

-Raymond Day
A 4 line LCD works with this. I got it working now.

This my help soma else the code at /etc/lcd4linux.conf file mine looks like this:

Code: Select all

Variables {
   tick 500
   tack 100
}

Display LCD2USB {
    Driver 'LCD2USB'         #Model: LCD2USB
    Size '20x4'            #LCD dimension: 2004
    Backlight 0
    Icons 1
}
 
Widget IPaddress {
    class 'Text'         #Type: Text
    expression netinfo::ipaddr('eth0')   #eth0's ip
    prefix 'IP: '         #display "IP: "
    width 20            #display width: 19
    align 'C'            #display: center
    update 1000                       
}
 
Widget Time {
    class 'Text'
    expression strftime('%a %I:%M:%S %p',time())
    width 20
    align 'C'
    update 1000
}

Widget Busy {
    class 'Text'
    expression proc_stat::cpu('busy', 500)
    prefix 'Busy '   
    postfix '%'   
    width 10   
    precision 1
    align 'R'   
    update tick   
}   

Widget BusyBar {
    class 'Bar'
    expression proc_stat::cpu('busy', 500)
    expression2 proc_stat::cpu('system', 500)
    length 10   
    direction 'E'
    update tack
}

Widget Load {
    class 'Text'
    expression loadavg(1)
    prefix 'Load '   
    postfix loadavg(1)>1.0?'!':' '
    width 10   
    precision 1
    align 'R'   
    update tick   
}   

Widget LoadBar {
    class 'Bar'
    expression loadavg(1)
    max 2.0
    length 10   
    direction 'E'
    update tack
}

Layout Default {
    Row1 {
        Col1 'IPaddress'      #Display Widget IPaddress in the first row and first column
    }
    Row2 {
        Col1 'Time'         #Display Widget Time in the second row and first column
    }
    Row3 {
   Col1 'Busy'
   Col11 'BusyBar'
    }
    Row4 {
   Col1 'Load'
   Col11 'LoadBar'
    }
}
 
Display 'LCD2USB'
Layout  'Default'


It shows the IP, time, Busy and load on the 4 lins. The load is how many programs are running.

Now just need to know how to program the buttons.

-Raymond Day
On that code change the timeline to this so can have AM and PM and not 24 hour time.

Just had to add the %p' at the end. I edit the whole lcd4linux.conf in here so it does the AM PM now. So this file goes in /etc/lcd4linux.conf.

Code: Select all

expression strftime('%a %I:%M:%S %p',time())


I like it better like that.

-Raymond Day
When I did a stress test and got this photo of the 4x20 LCD display.

https://photos.app.goo.gl/8mTar4TquvCTtVcS9

Just so people know what it looks like.

But I guess if would get the 2 buttons working could change the display to something else.

-Raymond Day
Still don't know how to get the 2 buttons to work on it. Be nice to press them for other display info.

-Raymond Day

Who is online

In total there are 10 users online :: 0 registered, 0 hidden and 10 guests (based on users active over the past 5 minutes)
Most users ever online was 5185 on Wed Jan 22, 2020 1:44 pm

Users browsing this forum: No registered users and 10 guests