Skip to content

Commit

Permalink
Merge pull request #5 from brentru/add-led-to-examples
Browse files Browse the repository at this point in the history
Add LED to Examples, update README
  • Loading branch information
kattni committed Dec 5, 2018
2 parents d5411fb + 1f12f0c commit 1bc6cae
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
33 changes: 33 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,31 @@ Please ensure all dependencies are available on the CircuitPython filesystem.
This is easily achieved by downloading
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.

Installing from PyPI
--------------------

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
PyPI <https://pypi.org/project/adafruit-circuitpython-tinylora/>`_. To install for current user:

.. code-block:: shell
pip3 install adafruit-circuitpython-tinylora
To install system-wide (this may be required in some cases):

.. code-block:: shell
sudo pip3 install adafruit-circuitpython-tinylora
To install in a virtual environment in your current project:

.. code-block:: shell
mkdir project-name && cd project-name
python3 -m venv .env
source .env/bin/activate
pip3 install adafruit-circuitpython-tinylora
Usage Example
=============

Expand Down Expand Up @@ -87,3 +112,11 @@ Now, once you have the virtual environment activated:
This will output the documentation to ``docs/_build/html``. Open the index.html in your browser to
view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to
locally verify it will pass.

License
=======
This library was written by ClemensRiederer. We've converted it to work with Adafruit CircuitPython and made
changes so it works with the Raspberry Pi and Adafruit Feather M0/M4. We've added examples for using this library
to transmit data and sensor data to The Things Network.

This open source code is licensed under the LGPL license (see LICENSE for details).
6 changes: 6 additions & 0 deletions examples/tinylora_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import board
from adafruit_tinylora.adafruit_tinylora import TTN, TinyLoRa

# Board LED
led = digitalio.DigitalInOut(board.D13)
led.direction = digitalio.Direction.OUTPUT

spi = busio.SPI(board.SCK, MISO=board.MISO, MOSI=board.MOSI)

# RFM9x Breakout Pinouts
Expand Down Expand Up @@ -34,5 +38,7 @@
print('Sending packet...')
lora.send_data(data, len(data), lora.frame_counter)
print('Packet sent!')
led.value = True
lora.frame_counter += 1
time.sleep(1)
led.value = False
5 changes: 5 additions & 0 deletions examples/tinylora_simpletest_si7021.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import adafruit_si7021
from adafruit_tinylora.adafruit_tinylora import TTN, TinyLoRa

# Board LED
led = digitalio.DigitalInOut(board.D13)
led.direction = digitalio.Direction.OUTPUT

# Create library object using our bus i2c port for si7021
i2c = busio.I2C(board.SCL, board.SDA)
Expand Down Expand Up @@ -61,5 +64,7 @@
print('Sending packet...')
lora.send_data(data, len(data), lora.frame_counter)
print('Packet Sent!')
led.value = True
lora.frame_counter += 1
time.sleep(2)
led.value = False

0 comments on commit 1bc6cae

Please sign in to comment.