How to control CFA 635 LEDs in LCDProc?

CF Tech

Administrator

p4blu

New member
sorry, but I cant understand it
I use lcdproc, and make my code in bash, acessing telnet etc..

its just digit this at telnet window?
 

CF Tech

Administrator
I am no expert on LCDproc . . .

From this page: http://lcdproc.sourceforge.net/docs/current-user.html

Example 5.8. Pyramid: How to use the LED output from the client

telnet localhost 13666
hello
output 67

will light up LEDs 3, 4 and 9.

output 0

will clear all LEDs.
Based on that and the previous quote I think this:

output 15

( 0b 0000 1111 ) should make the all the LEDs red.

output 240

( 0b 1111 0000 ) should make the all the LEDs green.

output 172

( 0b 1010 1100 ) should make the one orange, one green, one red, and one off.

Can you try those over telnet and see if the LEDs change?
 

p4blu

New member
there is anyway to get the actual states of the leds?
i want to make and script like
script -l [0,1,2,3] -c [red,green,amber]
but I need to know the actual state
 

CF Tech

Administrator
there is anyway to get the actual states of the leds? . . .
The module's firmware command set is able to return the state of the LEDs, but I do not know if LCDProc actually supports the operation. Is there an "input" that corresponds to the "output" function?
 

p4blu

New member
hello,

unfortunately no
"huh? Invalid command "input""

I had to make an code to load (at beggining) and to save (at finish) the "last_state", so I can change just a specifc led, and not the 4 ones
 

p4blu

New member
#!/bin/bash

led=$1
color=$2
control=(`cat /tmp/last_state`)

if [ "$control" == "" ]; then
echo "null file, changed to 00000001\n"
echo "0 0 0 0 0 0 0 1" > /tmp/last_state
else
echo "last state recover:"
echo ${control[@]}
fi

control=(`cat /tmp/last_state`)


if [ $led == "led1" ]
then
colorbit1=3
colorbit2=7
elif [ $led == "led2" ]
then
colorbit1=2
colorbit2=6
elif [ $led == "led3" ]
then
colorbit1=1
colorbit2=5
elif [ $led == "led4" ]
then
colorbit1=0
colorbit2=4
fi


if [ $color == "green" ]
then
colorbit1_value=0
colorbit2_value=1
elif [ $color == "red" ]
then
colorbit1_value=1
colorbit2_value=0
elif [ $color == "amber" ]
then
colorbit1_value=1
colorbit2_value=1
elif [ $color == "off" ]
then
colorbit1_value=0
colorbit2_value=0
fi

control[$colorbit1]=$colorbit1_value
control[$colorbit2]=$colorbit2_value

echo "new state update:"
echo ${control[@]}
control2=${control[@]}
echo $control2 > /tmp/last_state
bin="${control2// /}"
 

p4blu

New member
sorry for the delay..

copy this code, into a program.sh

chmod +x program.sh

mv program.sh /usr/bin/program.sh (so you can access from any folder...)

then use:

program ledX [1-4] color [green, red or amber]
 
Top