From 4ad1b9f450d3ba540e89efe106676b7b1e3961ea Mon Sep 17 00:00:00 2001 From: CalisJI Date: Wed, 21 Aug 2024 14:35:20 +0700 Subject: [PATCH] Update README --- README.md | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/README.md b/README.md index 9d8e9af..2504aa9 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,42 @@ ser.write(data_to_send) ser.close() ``` + +### Testing Game + +```python +import numpy as np +import serial +import struct + +# Tạo mảng NumPy +n = 2 +# Kích thước của mảng + +num_rows = 1 +num_cols = 0 + +data = np.array([[60, 120,1]]).astype(np.float32) +num_rows = data.shape[0] +num_cols = data.shape[1] + +# Chuyển mảng thành chuỗi byte +data_bytes = data.tobytes() +# Đóng gói kích thước và dữ liệu +header = struct.pack('