Serial - ozarchie/BlueBasic GitHub Wiki

Syntax

SERIAL <baud rate>,<parity>,<bits>,<stop bits>,<flow control> [ONREAD GOSUB <line no>] [ONWRITE GOSUB <line no>
READ #SERIAL, <variable> [, ...]
WRITE #SERIAL, <variable>|<number> [, ...]
<variable> = LEN(SERIAL READ|WRITE)
CLOSE SERIAL

Description

These commands relate to the serial port of the BLE device, not the BLE serial profile used to connect wirelessly to the BlueBasic editing terminal.

Data will be sent out via the Tx pin (P0(3)) and received via the Rx pin (P0(2)). Hardware control exists for data transmission (CTS-P0(4)) and reception (RTS-P0(5)). Be aware that the Rx and Tx pins have shared functionality with the MOSI and MISO pins used by the CCDebugger and will not function while it is attached. Also note that the default pin configurations for CTS and RTS do NOT enable communications. The device may require pull up resistors or the pins set for PULLUP.
Baud rate is selectable from - 9600, 19200, 38400, 57600, 115200.
Parity, Bits and Stop bits are set at - No parity (N), 8 data bits (8), and one stop bit (1).
Flow is selectable from - Hardware (H) (and None (N) - mikewen or BOTSPINE).

Examples

9 // "9600 baud, no parity, 8 bits, 1 stop bit, hardware handshaking"
10 SERIAL 9600,N,8,1,H ONREAD GOSUB 100
105 READ # SERIAL, A
115 WRITE # SERIAL,A

⚠️ **GitHub.com Fallback** ⚠️