aboutsummaryrefslogtreecommitdiff
path: root/nicla
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-05-24 15:51:25 +0200
committerlonkaars <loek@pipeframe.xyz>2023-05-24 15:51:25 +0200
commit4568db72dc3f9694ecae3506fc3de6ffc948b24f (patch)
tree9bd15762ff9bfe4143ec74e2684c42985b8b4d3b /nicla
parentd53f4014ab90dc09f6b9fff68391fc90a084de59 (diff)
WIP zumo<-nicla communication
Diffstat (limited to 'nicla')
-rw-r--r--nicla/serial_test.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/nicla/serial_test.py b/nicla/serial_test.py
new file mode 100644
index 0000000..bef43a2
--- /dev/null
+++ b/nicla/serial_test.py
@@ -0,0 +1,21 @@
+from pyb import Pin, delay
+
+zumo_tx = Pin("PA10", Pin.IN)
+zumo_rx = Pin("PA9", Pin.OUT_PP)
+
+def uart_send(s):
+ zumo_rx.value(0)
+ byte = ord(s)
+ print("START BIT")
+ delay(2)
+ for x in range(8):
+ bit = (byte & (1 << 7)) >> 7
+ byte <<= 1
+ zumo_rx.value(bit)
+ print(f"BIT[{x}] = {bit}")
+ delay(2)
+ print("STOP BIT")
+ zumo_rx.value(1)
+
+while True:
+ uart_send("a")