Display difficulty with pifacecad hat

I have one of these:

PiFace CAD hat.

It is a 2 x 16 LCD display.

There is a node for it and I made it better in that you can specify where on the display the message is set.

This is the basis of a new project I am about to start which may seem over the top, but hey..... I am wanting to give it a go.

I think I have found a 3.3v display and a compatible SPI bus driver for it. (Less pins used on the RasPi.)

The thing is I can't send a : to be displayed.

I am wanting to display a : and a / and a few other special characters.

I can understand that some characters are special and need to be handled differently.

Anyway, if I send a message hello world all I see on the display is hello. The world part is negated - probably because of the (space).

No big. I send it "hello world" and I see the message hello world. Great.

But if I then send it "hellow:world" all I see is hello again.

This is using the code supplied with the node.

#
import pifacecad
import sys

try:

     x = sys.argv[1].split(",")
     y = x[1].split(":")
except:
    raise TypeError("The entered text is not correct")

cad = pifacecad.PiFaceCAD()
cad.lcd.backlight_on()
cad.lcd.cursor_off()
cad.lcd.set_cursor (int(x[0])-1, int(y[0])-1)
if (y[1]):
    cad.lcd.write(y[1])

    cad.lcd.blink_off() 
#    cad.lcd.write(unicode(text))
else:
    cad.lcd.clear()

This code - however - displays the : in the message.

#!/usr/bin/env python3
 
import sys
import pifacecad
 
#print('Arguments:', len(sys.argv))
#print('List:', str(sys.argv))
 
#if sys.argv < 2:
#    print('Too few arguments, please specify a filename')
 
filename = sys.argv[1]
print('The paramater you entered is called')
print( filename)

cad = pifacecad.PiFaceCAD()
cad.lcd.backlight_on()
cad.lcd.clear()
cad.lcd.write(filename)

I shall sit down and try to work out what is going on, but as far as I can see, they are both using this piface thing at the start to display the message.

And they are both using:
cad.lcd.write( to write to the screen/display.

So I at a loss to see what is going on and why.

If someone is feeling kind. A bit of help would be appreciated.

You may be better asking on their github page as you are into the depths of their code not Node-RED

Yeah. I was just wanting to ask among people who know me and can maybe answer in ways I understand quicker.

No problem.

Oh, and the github where I got the node is very poorly supported.
It was written by the person for a purpose and they are sharing it but the code is problematic and I mentioned a couple of problems to which I got a dismissive reply.

I don't think help will be too easy to get.

Line 4 of the code splits the input on : and uses the first part to set the line to display on. So yes that would remove all :

So I would have to do something like:

cad.lcd.write(y[1])
cad.lcd.write(y[2])
cad.lcd.write(y[3])

To see all the numbers?

Sorry, I'll go away and look at the code again.

I went in and changed the line to:
y = x[1].split(";")

and changed the command from:
1,1:"Hello world"
to
1,1;"Hello world"
Didn't work.

So I am missing something else.

Don't worry. I'll see if I can work it out.

I thought split( splits the string at that character. Not so much removing them.

It does split on the character, and returns an array containing only the text between those characters (not the character itself).

Ok. Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.