Hello all,
I'm trying to connect a device with Uni Pi via Uart port (TX, RX).
I want to get information in Mervis from Arduino (some values from EC an pH sensors).
I own Unipi 1.1 hardware, use Mervis 2.3 and the protocol wanted is serial communication between Unipi 1.1 as the slave and Arduino Uno master.
I'm using a RJ11 connector from UART port on UniPi 1.1 to Arduino Uno:
- UART port GND --> Arduino GND pin
- UART port Rx --> Arduino Tx (pin 1)
- UART port Tx --> Arduino Rx (pin 0)
I've tried to open the port using:
def := 'serial:6:9600,8,N,1';
handle := io.openport(def);
if handle >= 0 then
state := 1;
end_if;
The state is updated to value "1" and then to value "2" after waiting for change of input value or timeout expiry after last values transmission - on case "1".
But in case "2" I'm getting some port statuses like 31/53/77 after attempting to open the port:
2:
if io.getportstatus(handle) = 0 then (* OperationStatus_Ok ) ( spojeni navazano *)
I tried different ports, with baud rate 9600 and second time with 115200 but I received the following errors:
- on port 1: OperationStatus_Empty = 31
- on ports 0, 2-9 and 20 - unknown error 77 (it's not in the list with possible return values)
- on ports 10-19 - OperationStatus_FileNotFound = 53.
Could you please advise on:
- how to open that port / connect the serial port
- what alternative do I have to make this communication between Arduino Uno and Uni Pi 1.1 to work
- what is OpenPort?