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.
2 parents 36257b8 + 0717dac commit 240bc95Copy full SHA for 240bc95
examples/ch9328_simpletest.py
@@ -6,12 +6,21 @@
6
7
import time
8
import board
9
-import busio
10
from adafruit_ch9328.ch9328 import Adafruit_CH9328
11
from adafruit_ch9328.ch9328_keymap import Keymap
12
13
# Initialize UART for the CH9328
14
-uart = busio.UART(board.TX, board.RX, baudrate=9600)
+# check for Raspberry Pi
+# pylint: disable=simplifiable-condition
15
+if "CE0" and "CE1" in dir(board):
16
+ import serial
17
+
18
+ uart = serial.Serial("/dev/ttyS0", baudrate=9600, timeout=3000)
19
+# otherwise use busio
20
+else:
21
+ import busio
22
23
+ uart = busio.UART(board.TX, board.RX, baudrate=9600)
24
ch9328 = Adafruit_CH9328(uart)
25
26
# Wait for 2 seconds
0 commit comments