# Display difficulty with pifacecad hat

**URL:** <https://discourse.nodered.org/t/display-difficulty-with-pifacecad-hat/30749>\
**Category:** General\
**Created:** [27 July 2020 02:09 UTC](https://discourse.nodered.org/t/display-difficulty-with-pifacecad-hat/30749 "2020-07-27T02:09:09Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 July 2020 02:09 UTC](https://discourse.nodered.org/t/display-difficulty-with-pifacecad-hat/30749/1 "2020-07-27T02:09:10Z")

</div>

I have one of these:

[PiFace CAD hat.](https://www.element14.com/community/people/Problemchild/blog/2013/12/25/piface-control-display-tear-down)

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.

```auto
#
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.

```auto
#!/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.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [27 July 2020 07:03 UTC](https://discourse.nodered.org/t/display-difficulty-with-pifacecad-hat/30749/2 "2020-07-27T07:03:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 July 2020 07:04 UTC](https://discourse.nodered.org/t/display-difficulty-with-pifacecad-hat/30749/3 "2020-07-27T07:04:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [27 July 2020 07:18 UTC](https://discourse.nodered.org/t/display-difficulty-with-pifacecad-hat/30749/4 "2020-07-27T07:18:48Z")

</div>

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 :

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 July 2020 07:21 UTC](https://discourse.nodered.org/t/display-difficulty-with-pifacecad-hat/30749/5 "2020-07-27T07:21:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 July 2020 07:37 UTC](https://discourse.nodered.org/t/display-difficulty-with-pifacecad-hat/30749/6 "2020-07-27T07:37:46Z")

</div>

> [@dceejay](#):
>
> 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 :

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.

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 July 2020 08:14 UTC](https://discourse.nodered.org/t/display-difficulty-with-pifacecad-hat/30749/7 "2020-07-27T08:14:59Z")

</div>

> [@dceejay](#):
>
> So yes that would remove all :

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [27 July 2020 08:36 UTC](https://discourse.nodered.org/t/display-difficulty-with-pifacecad-hat/30749/8 "2020-07-27T08:36:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)\
**Post date:** [27 July 2020 08:37 UTC](https://discourse.nodered.org/t/display-difficulty-with-pifacecad-hat/30749/9 "2020-07-27T08:37:05Z")

</div>

Ok. Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [10 August 2020 08:37 UTC](https://discourse.nodered.org/t/display-difficulty-with-pifacecad-hat/30749/10 "2020-08-10T08:37:07Z")

</div>

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