We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4aa63fd commit b5ee85aCopy full SHA for b5ee85a
RS-232_Pal_Demos/CircuitPython/code.py
@@ -3,11 +3,21 @@
3
4
import time
5
import board
6
-import busio
7
8
# baud rate for your device
9
baud = 38400
10
-uart = busio.UART(board.TX, board.RX, baudrate=baud)
+# Initialize UART for the CH9328
+# check for Raspberry Pi
11
+# pylint: disable=simplifiable-condition
12
+if "CE0" and "CE1" in dir(board):
13
+ import serial
14
+
15
+ uart = serial.Serial("/dev/ttyS0", baudrate=baud, timeout=3000)
16
+# otherwise use busio
17
+else:
18
+ import busio
19
20
+ uart = busio.UART(board.TX, board.RX, baudrate=baud)
21
22
print("Enter commands to send to the RS-232 device. Press Ctrl+C to exit.")
23
while True:
0 commit comments