Skip to content

Commit 699ce20

Browse files
committed
add LED output to example
1 parent 2310d9f commit 699ce20

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

examples/rfm69_simpletest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
#CS = digitalio.DigitalInOut(board.RFM69_CS)
2222
#RESET = digitalio.DigitalInOut(board.RFM69_RST)
2323

24+
# Define the onboard LED
25+
LED = digitalio.DigitalInOut(board.D13)
26+
LED.direction = digitalio.Direction.OUTPUT
27+
2428
# Initialize SPI bus.
2529
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
2630

@@ -55,9 +59,12 @@
5559
#packet = rfm69.receive(timeout=5.0)
5660
# If no packet was received during the timeout then None is returned.
5761
if packet is None:
62+
# Packet has not been received
63+
LED.value = False
5864
print('Received nothing! Listening again...')
5965
else:
6066
# Received a packet!
67+
LED.value = True
6168
# Print out the raw bytes of the packet:
6269
print('Received (raw bytes): {0}'.format(packet))
6370
# And decode to ASCII text and print it too. Note that you always

0 commit comments

Comments
 (0)