File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 19
19
# CS = digitalio.DigitalInOut(board.RFM9X_CS)
20
20
# RESET = digitalio.DigitalInOut(board.RFM9X_RST)
21
21
22
+ # Define the onboard LED
23
+ LED = digitalio .DigitalInOut (board .D13 )
24
+ LED .direction = digitalio .Direction .OUTPUT
25
+
22
26
# Initialize SPI bus.
23
27
spi = busio .SPI (board .SCK , MOSI = board .MOSI , MISO = board .MISO )
24
28
44
48
# This means you should only use this for low bandwidth scenarios, like sending
45
49
# and receiving a single message at a time.
46
50
print ('Waiting for packets...' )
51
+
47
52
while True :
48
53
packet = rfm9x .receive ()
49
54
# Optionally change the receive timeout from its default of 0.5 seconds:
50
55
#packet = rfm9x.receive(timeout=5.0)
51
56
# If no packet was received during the timeout then None is returned.
52
57
if packet is None :
58
+ # Packet has not been received
59
+ LED .value = False
53
60
print ('Received nothing! Listening again...' )
54
61
else :
55
62
# Received a packet!
63
+ LED .value = True
56
64
# Print out the raw bytes of the packet:
57
65
print ('Received (raw bytes): {0}' .format (packet ))
58
66
# And decode to ASCII text and print it too. Note that you always
You can’t perform that action at this time.
0 commit comments