Skip to content

Commit

Permalink
Updated documentation and setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
speratus committed Jul 23, 2019
1 parent 619101e commit 64a848f
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 13 deletions.
40 changes: 29 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,44 @@
# README
Blinkter makes using the [Pimoroni Blinkt!](https://shop.pimoroni.com/products/blinkt) even easier by making it object oriented and
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/blinkter.svg)
[![Documentation Status](https://readthedocs.org/projects/blinkter/badge/?version=latest)](https://blinkter.readthedocs.io/en/latest/?badge=latest)
![GitHub release](https://img.shields.io/github/release/speratus/Blinkter.svg)
![PyPI](https://img.shields.io/pypi/v/blinkter.svg?color=green)
[![GitHub license](https://img.shields.io/github/license/speratus/Blinkter.svg)](https://github.com/speratus/Blinkter/blob/master/LICENSE)
[![GitHub issues](https://img.shields.io/github/issues/speratus/Blinkter.svg)](https://github.com/speratus/Blinkter/issues)
[![GitHub forks](https://img.shields.io/github/forks/speratus/Blinkter.svg)](https://github.com/speratus/Blinkter/network)


Blinkter makes using the [Pimoroni Blinkt!](https://shop.pimoroni.com/products/blinkt) even easier by making the library object oriented and
adding several convenience methods. The intuitive objects that Blinkter layers on top of the [Blinkt!](https://github.com/pimoroni/blinkt)
python library greatly improve ease of use and reduce development times.
# Installation
1. In order to install Blinkter, first make sure that `setuptools` is installed.
'''

## Easy Way
```
pip install blinkter
```
## Harder way
If you want to play around with the Blinkter code, the following steps will guide you through getting the repository
and installing the library from your code.

1. Make sure that `setuptools` is installed.
```
pip install setuptools
'''
```
2. Next, clone this repository with
```
git clone https://github.com/speratus/Blinkter.git
```
3. Once you have the repository setup on your system, you will have to generate the installation files with `setuptools`.
Run the following command:
```
python setup.py sdist
```
4. Once `setup.py` finishes building the library, you can install it using this command:

3. Once the repository is downloaded, install it using this command:
```
python setup.py install
```
That's all there is to it. You should be ready to go in no time at all.

## Installing into a virtual environment.
Installing Blinkter into a virtual environment is not much harder than a regular installation of Blinkter.
Follow steps 1 through 3 as you normally would, but before executing step 4, make sure that your virtual environment is activated.
Follow steps 1 and 2 as you normally would, but before executing step 3, make sure that your virtual environment is activated.
### Windows
On windows this is achieved using the command:
```
Expand All @@ -46,3 +60,7 @@ board = blinkter.BlinktBoard()
pixel = board.get_pixel(0) #Or whatever pixel you want to manipulate
pixel.red() #Or pixel.blue(), or whatever else you want.
```
# Links
* [Pimoroni Blinkt! product page](https://shop.pimoroni.com/products/blinkt)
* [Blinkt library](https://github.com/pimoroni/blinkt)
* [Documentation](https://blinkter.readthedocs.io/)
8 changes: 7 additions & 1 deletion blinkter/led.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@

class LED(enum.Enum):
"""
An enum representing the primary colors available on the blinkt board
An enum representing the primary colors available on the blinkt board.
The possible values are as follows:
.. codeblock:python3
RED = 0
GREEN = 1
BLUE = 2
"""
RED = 0
GREEN = 1
Expand Down
9 changes: 9 additions & 0 deletions docs/classes/LED.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. currentmodule:: blinkter

LED
===
Represents the possible LEDs in an individual pixel. This class needs only
be used in methods of the :class:`Pixel` class.

.. autoclass:: LED
:members:
7 changes: 7 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@
master_doc = 'index'
autodoc_mock_imports = ['blinkt']

rst_prolog = """
.. |pimoroni| replace:: Pimoroni Blinkt!
.. _pimoroni: https://shop.pimoroni.com/products/blinkt
.. |blinkt| replace:: blinkt
.. _blinkt: https://github.com/pimoroni/blinkt
"""

# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
Expand Down
52 changes: 52 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,67 @@
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
.. currentmodule:: blinkter

Welcome to blinkter's documentation!
====================================

What is Blinkter?
------------------
Blinkter is an API to use with the |pimoroni|_ led hat for the Raspberry Pi. It adds many features lacking from
the |blinkt|_ library provided by pimoroni. See the section below for a more complete list.

Features
--------
Here are some of the features that blinkter offers.

- Object oriented design

* The original blinkt library is not object oriented
* Object oriented design is particularly intuitive in the case of the pimoroni Blinkt! because the blinkt is actually
an object.

- Super convenient methods for setting the pixels to the three basic colors (red, green, and blue).
- Adds a :meth:`~Pixel.flash` method for easy flashing.
- If you don't just want to flash LEDs, but you also want to blink them, you should check out the built in
:meth:`~Pixel.start_blink` and :meth:`~Pixel.stop_blink` for more information.

Quick demonstration
-------------------
Cycle through the basic colors.
.. code-block::python3
import time
from blinkter import BlinktBoard
board = BlinktBoard()
pixel = board.get_pixel(0) #As with blinkt, the pixels are labelled 0-7.
pixel.red()
time.sleep(1)
pixel.green()
time.sleep(1)
pixel.blue()
time.sleep(3)
pixel.black() #Turn the pixel off when you're done.
Cause a pixel to flash once.
.. code-block::python3
pixel.flash(r=255, duration=0.1)
Blink a pixel repeatedly
.. code-block::python3
pixel.start_blink(g=255, on_length=0.075, off_length=0.2)
time.sleep(3)
pixel.stop_blink()
.. toctree::
:maxdepth: 2
:caption: Contents:

classes/BlinktBoard
classes/Pixel
classes/LED



Expand Down
17 changes: 16 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,24 @@

from setuptools import setup, find_packages

with open('README.md', 'r') as fh:
long_description = fh.read()

setup(
name='blinkter',
version='0.1.5.4',
packages=find_packages(),
install_requires=['blinkt >= 0.1.2']
install_requires=['blinkt >= 0.1.2'],
author='Andrew Luchuk',
author_email='spaxumof@gmail.com',
description='A high level library for interacting with the Pimoroni Blinkt.',
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/speratus/Blinkter',
classifiers=[
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.7',
'License :: OSI Approved :: MIT License',
'Operating System :: POSIX :: Linux',
]
)

0 comments on commit 64a848f

Please sign in to comment.