Post by Tasp on Oct 30, 2022 12:05:30 GMT -5
I am trying to access the Pi's serial comms port. Connecting a Nextion touchscreen display which outputs serial RS232 UART
The following just creates a blank file in the folder that the .bas is located and run from;
The LB5 helpfile suggests it's coded right, however the Alpha readme doesn't speak about comms ports.
Off to the forum I go and find this thread from Oct 2019; basically not implemented yet in 350......Guess this is still the case which is rather disappointing. Carl, please don't make me learn Python! I can barely do LB!
When reading this thread about the GPIO pins; Chris shows how the GPIo pins are just looking at files.
Sure enough the docs say;
Python code for accessing the UART pins
So I went down this route, sadly without much success. This gives "attempted to open non existent file", which is obviously correct.
Interestingly this path gives "illegal seek"
I have also tried;
I have confirmed serial is enabled on the Pi as I can communicate with the touchscreen via Putty.
Bluetooth is disables so it isn't looking at the wrong port.
Anyone have any ideas?
Edit: Pi 4 4GB Pi OS Bullseye
The following just creates a blank file in the folder that the .bas is located and run from;
open "COM1:9600,0,8,1" for random as #serial
timer 100, [collectSerial]
WAIT
close #serial
[collectSerial]
numbytes = lof(#serial)
IF numbytes <> 0 THEN
dataRead$ = input$(#serial, numbytes)
print numbytes, dataRead$
end if
wait
end
The LB5 helpfile suggests it's coded right, however the Alpha readme doesn't speak about comms ports.
Off to the forum I go and find this thread from Oct 2019; basically not implemented yet in 350......Guess this is still the case which is rather disappointing. Carl, please don't make me learn Python! I can barely do LB!
When reading this thread about the GPIO pins; Chris shows how the GPIo pins are just looking at files.
Sure enough the docs say;
Each UART has an associated serial device. A device is a "file" which the operating system make the UART and it's associated serial port available to software"
Python code for accessing the UART pins
ser = serial.Serial ("/dev/ttyS0", 9600)
So I went down this route, sadly without much success. This gives "attempted to open non existent file", which is obviously correct.
timer 100, [getSerial]
WAIT
[getSerial]
open "/sys/class/ttyS0" for input as #file
print #file;
WAIT
Interestingly this path gives "illegal seek"
open "/dev/ttyS0" for input as #file
I have also tried;
/dev/ttyAMA0
/dev/serial0
/dev/serial1
I have confirmed serial is enabled on the Pi as I can communicate with the touchscreen via Putty.
Bluetooth is disables so it isn't looking at the wrong port.
Anyone have any ideas?
Edit: Pi 4 4GB Pi OS Bullseye