We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bb21868 commit 3b900f2Copy full SHA for 3b900f2
CPX_Serial/serial-read-write.py
@@ -0,0 +1,18 @@
1
+import time
2
+import board
3
+import busio
4
+from adafruit_circuitplayground.express import cpx
5
+
6
+uart = busio.UART(board.TX, board.RX, baudrate=115200)
7
8
+while True:
9
10
+ data = uart.read(1) # read a byte
11
12
+ if data is not None: # Data was received
13
14
+ output = "%0.1f\t%d\t%0.1f\r\n" % (time.monotonic(),
15
+ cpx.light, cpx.temperature)
16
+ uart.write(output) # Print to serial
17
18
+ time.sleep(1.0)
0 commit comments