Delete tunerlistd/test.py
This commit is contained in:
parent
69530f84a1
commit
ffc001b603
@ -1,35 +0,0 @@
|
|||||||
import pigpio
|
|
||||||
import time
|
|
||||||
|
|
||||||
PIN = 24
|
|
||||||
BAUD = 600
|
|
||||||
|
|
||||||
pi = pigpio.pi()
|
|
||||||
if not pi.connected:
|
|
||||||
raise RuntimeError("pigpio daemon not running")
|
|
||||||
|
|
||||||
# Open bit-bang serial read on GPIO 24 at 600 baud
|
|
||||||
pi.bb_serial_read_close(PIN)
|
|
||||||
pi.bb_serial_read_open(PIN, BAUD)
|
|
||||||
|
|
||||||
try:
|
|
||||||
buffer = bytearray()
|
|
||||||
print("Listening on GPIO 24 for serial data...")
|
|
||||||
|
|
||||||
while True:
|
|
||||||
(count, data) = pi.bb_serial_read(PIN)
|
|
||||||
if count > 0:
|
|
||||||
for byte in data:
|
|
||||||
if byte == 0xFF:
|
|
||||||
print("Received:", buffer)
|
|
||||||
buffer.clear()
|
|
||||||
else:
|
|
||||||
buffer.append(byte)
|
|
||||||
time.sleep(0.01) # Slight delay to avoid CPU hogging
|
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
print("\nStopped by user.")
|
|
||||||
|
|
||||||
finally:
|
|
||||||
pi.bb_serial_read_close(PIN)
|
|
||||||
pi.stop()
|
|
Loading…
x
Reference in New Issue
Block a user