Re: Printing to LCD display


 

tail -f /var/log/Headers.log | sed 's/.*My: \(.*\) Your.*/\1/' >> /dev/ttyXX  

(All headers MY field, including /xxxx")

tail -f /var/log/Headers.log | sed 's/.* DPlus.*My: \(.*\) Your.*/\1/' >> /dev/ttyXX  

(For only DPlus headers)

tail -f /var/log/Headers.log | sed 's/.*My: \(.*\)\/.*/\1/' >> /dev/ttyXX  

(If you don't want the /xxxx)

John D. Hays
K7VE
PO Box 1223, Edmonds, WA 98020-1223 
  



On Sun, Mar 24, 2013 at 2:06 PM, Rick Simpson <goatguy101@...> wrote:
 

Ah, the joys of  shell scripting. All you need is a one-line script that pipes the file through a grep statement that selects the portion of the line you want to display through another pipe to the serial port on the LCD. Something of the form:
 
 
cat Headers.log | grep 'selection phrase' | /dev/ttyXX
 
I am sure someone on this list can fill in the details  :)
 
Rick
 
 
----- Original Message -----
From: mark_w6sat
Sent: Sunday, March 24, 2013 3:14 PM
Subject: [Raspberry_Pi_4-Ham_RADIO] Printing to LCD display

 

Hello all. I bought the 16x2 LCD display from Radio Shack. It has a serial interface so all that is needed is 3 pins from the Pi, some changes in a couple files and you can send text to the screen.

I'm looking to for anyone that knows how to parse a log file and be able to format it to send to the screen either in python or bash. Below is the format of file from Headers.log

2013-03-24 18:43:25: DPlus header - My: xx6xxx /DVAP Your: CQCQCQ Rpt1: REF012 A Rpt2: REF012 A Flags: 00 00 00

I'm looking to capture the callsign after "My:" and send it to the display and have it update the screen as the Headers.log file changes.

I can echo to the screen and have even made a small python script to display messages but I have no idea how to dynamically take info from a log file and send to the LCD screen.

Thanks and 73

Ted
W6SAT

P.S. Here is the python script. You have to do a:
#apt-get install python-serial to get it working.

root@raspberrypi:/temp# cat hello
#!/usr/bin/env python
import serial
import time

ser = serial.Serial(port='/dev/ttyAMA0', baudrate=9600)
if ser.isOpen():
ser.write(chr(12))
ser.write(chr(17))
ser.write("hello")
ser.write(chr(13))
ser.write(chr(220))
ser.write("Dstar")
time.sleep(3)
ser.write(chr(12))
ser.write(chr(18))


Join RaspberryPi-4-HamRadio@groups.io to automatically receive all group messages.