From 699ce207702b8d7cd72a36b01b706d5660b44299 Mon Sep 17 00:00:00 2001 From: brentru Date: Mon, 31 Dec 2018 17:58:15 -0500 Subject: [PATCH] add LED output to example --- examples/rfm69_simpletest.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/examples/rfm69_simpletest.py b/examples/rfm69_simpletest.py index 428e845..2b7b849 100644 --- a/examples/rfm69_simpletest.py +++ b/examples/rfm69_simpletest.py @@ -21,6 +21,10 @@ #CS = digitalio.DigitalInOut(board.RFM69_CS) #RESET = digitalio.DigitalInOut(board.RFM69_RST) +# Define the onboard LED +LED = digitalio.DigitalInOut(board.D13) +LED.direction = digitalio.Direction.OUTPUT + # Initialize SPI bus. spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO) @@ -55,9 +59,12 @@ #packet = rfm69.receive(timeout=5.0) # If no packet was received during the timeout then None is returned. if packet is None: + # Packet has not been received + LED.value = False print('Received nothing! Listening again...') else: # Received a packet! + LED.value = True # Print out the raw bytes of the packet: print('Received (raw bytes): {0}'.format(packet)) # And decode to ASCII text and print it too. Note that you always