Search skills to create a plugin for Pcp running on Pi4.
I'm a complete beginner in Pi and I'll need help.
I can pay something or offer some electronic components in exchange.
What I would need:
- Output the metadatas (title, artist,...) on the GPIO14 TX uart line. (the same that are displayed on the LCD screen).
Programs that display these metadatas on a 5x7 display (HD44780) exist. Could we redirect the output not to the LCD but to the UART?
(ex:
https://github.com/MartyTremblay/piC...yer-i2c-LCD.py
https://forums.slimdevices.com/showt...layer-%A32-LCD
)
- Send commands (play, stop, .... (maybe the same commands as those used for IR)) through the GPIO15 RX line.
Can someone make me a proposal?
Thanks in advance.
Results 1 to 10 of 37
-
2022-01-21, 07:29 #1
- Join Date
- Jan 2022
- Location
- Switzerland
- Posts
- 146
Search skills to create a plugin for Pcp running on Pi4.
-
2022-01-22, 12:20 #2
- Join Date
- Oct 2005
- Location
- Ireland
- Posts
- 21,511
Attached is a python program (an example from PySerial) which acts as a relay between a TCP port and a serial line. It works on Ubuntu - don't know about PCP
Since the python prog readsq.py is used for the HD44780 display - I presume a version of python is available on pcp. However the python Serial module may not be on PCP so that would need to be checked.
To run - example below:
LMS is on same host as python prog - IP address is 192.168.0.126
LMS CLI is configured on port 9090 - same as for the HD44780 utility.
The serial port below is on /dev/ttyUSB2
Serial line option such as speed etc are available as command line option use "-h" to find out syntax.
Code:python3 tcp_serial_redirect.py -c 192.168.0.126:9090 /dev/ttyUSB2
CLI commands end with ASCII <LF> 0x0A or CTRL/J
A CLI command to test whether it works would be
Code:player id ?<LF>
Last edited by bpa; 2022-01-22 at 12:34. Reason: typos and attribute source of prog.
-
2022-01-23, 02:23 #3
- Join Date
- Oct 2005
- Location
- Ireland
- Posts
- 21,511
There is a python extension for pcp and there is also a pip extension which I presume it is Python's pip repository tool. If that is the case, you can install pyserial using pip.
It looks like you know how to get serial port workiogn opn PCP - the python prog expects a standard Linux serial device port driver.
After installation you'll need to make installed programs them persistent using pcp's documented methods.
-
2022-01-23, 02:25 #4
- Join Date
- Jan 2022
- Location
- Switzerland
- Posts
- 146
Thanks a lot bpa.
PcP use microPython.
I tried a get this message:
Code:tc@pCP:~$ micropython serial.py Traceback (most recent call last): File "serial.py", line 11, in <module> File "/home/tc/serial.py", line 12, in <module> ImportError: no module named 'serial.threaded'
-
2022-01-23, 02:27 #5
- Join Date
- Oct 2005
- Location
- Ireland
- Posts
- 21,511
-
2022-01-23, 02:54 #6
- Join Date
- Oct 2005
- Location
- Ireland
- Posts
- 21,511
If pyserial was installed but does not have the serial.threaded part (i.e. old version of pyserial) then perhaps the legacy version of example (attached) may work as it does not use serial.threaded.
If micropython does not support "threading" - not sure but you may be able to rewrite using _thread ?
edit:
No real possibility of python on PCP see
https://forums.slimdevices.com/showt...l=1#post973773Last edited by bpa; 2022-01-23 at 02:58.
-
2022-01-23, 03:31 #7
- Join Date
- Jan 2022
- Location
- Switzerland
- Posts
- 146
With the new file:
tc@pCP:~$ micropython serial2.py
Traceback (most recent call last):
File "serial2.py", line 63
SyntaxError: invalid syntax
I downloaded the pyserial-3.5.tar.gz but how to tranfer it from my download directory to the pi ?
I tried
iMac-480:downloads ph$ scp pyserial-3.5.tar.gz pi@192.168.1.120:root/
pi@192.168.1.120's password:
It's not raspberry not piCore...
-
2022-01-23, 04:03 #8
- Join Date
- Oct 2005
- Location
- Ireland
- Posts
- 21,511
Before going further.
Did you check out the suggestion of using netcat aka nc ?
I did a very very quick test on Ubuntu and it seem to work.
Example.
Code:nc 192.168.0.98 9090 </dev/ttyUSB1 >/dev/ttyUSB1
-
2022-01-23, 04:21 #9
- Join Date
- Oct 2005
- Location
- Ireland
- Posts
- 21,511
Works ok on my Ubuntu Python 3.8 - Looks like a micropython limitation or possibly some sort of tab/space indentation problem.
I downloaded the pyserial-3.5.tar.gz but how to tranfer it from my download directory to the pi ?
I tried
iMac-480:downloads ph$ scp pyserial-3.5.tar.gz pi@192.168.1.120:root/
pi@192.168.1.120's password:
It's not raspberry not piCore...
-
2022-01-23, 05:04 #10
- Join Date
- Oct 2005
- Location
- Ireland
- Posts
- 21,511
Assuming you can build a simple C program on PCP - example of a simple telnet program which will do similar to socat / netcat
https://l3net.wordpress.com/projects...elnet-project/
source on sf https://sourceforge.net/projects/simpletelnet/
After building the following worked on Ubuntu
Code:stelnet 192.168.0.98 9090 </dev/ttyUSB1 >/dev/ttyUSB1