
bstaehling
USA
Asked
— Edited

SendSerial works great for sending serial data out of a digital port. Do the digital ports have the capability to receive serial data? If so, what is the scripting command (e.g. ReceiveSerial(baud) )? Or else do I have to use the UART port?
- D5 (TX) and D6 (RX) can be used as UART1
with 5kB Receive buffer
- D18 (TX) and D19 (RX) can be used as UART2
with 5kB Receive buffer
UARTInit( boardIndex, port, baudRate )
Initialize the Peripheral UART on the EZ-B v4 with the specified baud rate.
The Board Index is the EZ-B index starting at 0.
The port can be 0, 1 or 2.
The baud rate can be between 1 and 3750000 bps. The UART receive buffers on the EZ-B v4 are 5,000 bytes.
Example: UARTInit(0, 0, 9600 )
UARTAvailable( boardIndex, port )
Receive the count of bytes available in the Peripheral UART Receive Buffer of the EZ-B v4. The UART receive buffers on the EZ-B v4 are 5,000 bytes.
The Board Index is the EZ-B index starting at 0.
The port can be 0, 1 or 2.
Example: UARTAvailable(0, 0)
UARTRead( boardIndex, port, numBytes )
Receive the bytes from the Peripheral UART Receive Buffer of the EZ-B v4. The UART receive buffers on the EZ-B v4 are 5,000 bytes.
To know how many bytes are available, use the UARTAvailable() function.
The Board Index is the EZ-B index starting at 0.
The port can be 0, 1 or 2.
Example: UARTRead(0, 0, 10)
Example: UARTRead(0, 0, UARTAvailable(0, 1))
UARTWrite( boardIndex, port, data )
Write data through the Peripheral UART.
The Board Index is the EZ-B index starting at 0.
The port can be 0, 1 or 2.
Example: UARTWrite(0, 0, hello world )
Example: UARTWrite(0, 0, 0x30, 0x40, hello )
There's also a good project example in the cloud you can download to see how it works. Look for the UART example.