commit ef113064f074d540a0490a1619e676605641fc35 Author: Dave Astels Date: Sat Sep 30 15:13:01 2017 -0400 Code added to Circuit Python project template diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..92d3065 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +__pycache__ +_build +*.pyc diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..009a51a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,53 @@ +# Travis CI configuration for automated .mpy file generation. +# Author: Tony DiCola +# License: Public Domain +# This configuration will work with Travis CI (travis-ci.org) to automacially +# build .mpy files for CircuitPython when a new tagged release is created. This +# file is relatively generic and can be shared across multiple repositories by +# following these steps: +# 1. Copy this file into a .travis.yml file in the root of the repository. +# 2. Change the deploy > file section below to list each of the .mpy files +# that should be generated. The config will automatically look for +# .py files with the same name as the source for generating the .mpy files. +# Note that the .mpy extension should be lower case! +# 3. Commit the .travis.yml file and push it to GitHub. +# 4. Go to travis-ci.org and find the repository (it needs to be setup to access +# your github account, and your github account needs access to write to the +# repo). Flip the 'ON' switch on for Travis and the repo, see the Travis +# docs for more details: https://docs.travis-ci.com/user/getting-started/ +# 5. Get a GitHub 'personal access token' which has at least 'public_repo' or +# 'repo' scope: https://help.github.com/articles/creating-an-access-token-for-command-line-use/ +# Keep this token safe and secure! Anyone with the token will be able to +# access and write to your GitHub repositories. Travis will use the token +# to attach the .mpy files to the release. +# 6. In the Travis CI settings for the repository that was enabled find the +# environment variable editing page: https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings +# Add an environment variable named GITHUB_TOKEN and set it to the value +# of the GitHub personal access token above. Keep 'Display value in build +# log' flipped off. +# 7. That's it! Tag a release and Travis should go to work to add .mpy files +# to the release. It takes about a 2-3 minutes for a worker to spin up, +# build mpy-cross, and add the binaries to the release. +language: generic + +sudo: true + +deploy: + provider: releases + api_key: $GITHUB_TOKEN + file: + - "adafruit_dotstar_featherwing.mpy" + skip_cleanup: true + on: + tags: true + +before_install: +- sudo apt-get -yqq update +- sudo apt-get install -y build-essential git python python-pip +- git clone https://github.com/adafruit/circuitpython.git +- make -C circuitpython/mpy-cross +- export PATH=$PATH:$PWD/circuitpython/mpy-cross/ +- sudo pip install shyaml + +before_deploy: +- shyaml get-values deploy.file < .travis.yml | sed 's/.mpy/.py/' | xargs -L1 mpy-cross diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..1617586 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at support@adafruit.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..451dcc5 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2017 Dave Astels for ZombieWizard + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..35ad5c3 --- /dev/null +++ b/README.rst @@ -0,0 +1,63 @@ + +Introduction +============ + +.. image:: https://readthedocs.org/projects/adafruit-circuitpython-dotstar_featherwing/badge/?version=latest + :target: https://circuitpython.readthedocs.io/projects/dotstar_featherwing/en/latest/ + :alt: Documentation Status + +.. image :: https://badges.gitter.im/adafruit/circuitpython.svg + :target: https://gitter.im/adafruit/circuitpython?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge + :alt: Gitter + +A higher level library for working with the DotStar FeatherWing, build on top of the CircuitPython DotStar driver. + +Dependencies +============= +This driver depends on: + +* `Adafruit CircuitPython `_ +* `Adafruit CircuitPython DotStar `_ + +Please ensure all dependencies are available on the CircuitPython filesystem. +This is easily achieved by downloading +`the Adafruit library and driver bundle `_. + +Usage Example +============= + +``` +import board +import dotstar_featherwing +wing = dotstar_featherwing.DotstarFeatherwing(board.D13, board.D11) + +xmas = ["..y.w......w", + "..G.....w...", + "..G..w....w.", + ".GGG...w....", + "GGGGG.......", + "wwwwwwwwwwww"] + +xmas_colours = {'w': (0x20, 0x20, 0x20), + 'W': (0xFF, 0xFF, 0xFF), + 'G': (0x00, 0x20, 0x00), + 'y': (0x20, 0x20, 0x00), + 'Y': (0xFF, 0xFF, 0x00)} + +wing.display_coloured_image(xmas, xmas_colours) +``` + +Contributing +============ + +Contributions are welcome! Please read our `Code of Conduct +`_ +before contributing to help this project stay welcoming. + +API Reference +============= + +.. toctree:: + :maxdepth: 2 + + api diff --git a/api.rst b/api.rst new file mode 100644 index 0000000..ce7b7b8 --- /dev/null +++ b/api.rst @@ -0,0 +1,5 @@ + +.. If you created a package, create one automodule per module in the package. + +.. automodule:: adafruit_dotstar_featherwing + :members: diff --git a/conf.py b/conf.py new file mode 100644 index 0000000..f90dd53 --- /dev/null +++ b/conf.py @@ -0,0 +1,142 @@ +# -*- coding: utf-8 -*- + +import os +import sys +sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ------------------------------------------------ + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.intersphinx', + 'sphinx.ext.viewcode', +] + +intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'BusDevice': ('https://circuitpython.readthedocs.io/projects/bus_device/en/latest/', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)} + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'README' + +# General information about the project. +project = u'Adafruit DOTSTAR_FEATHERWING Library' +copyright = u'2017 Dave Astels' +author = u'Dave Astels' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = u'1.0' +# The full version, including alpha/beta/rc tags. +release = u'1.0' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This patterns also effect to html_static_path and html_extra_path +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +# +default_role = "any" + +# If true, '()' will be appended to :func: etc. cross-reference text. +# +add_function_parentheses = True + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +on_rtd = os.environ.get('READTHEDOCS', None) == 'True' + +if not on_rtd: # only import and set the theme if we're building docs locally + try: + import sphinx_rtd_theme + html_theme = 'sphinx_rtd_theme' + html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.'] + except: + html_theme = 'default' + html_theme_path = ['.'] +else: + html_theme_path = ['.'] + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Output file base name for HTML help builder. +htmlhelp_basename = 'AdafruitDOTSTAR_FEATHERWINGLibrarydoc' + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'AdafruitDOTSTAR_FEATHERWINGLibrary.tex', u'Adafruit DOTSTAR_FEATHERWING Library Documentation', + author, 'manual'), +] + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'adafruitDOTSTAR_FEATHERWINGlibrary', u'Adafruit DOTSTAR_FEATHERWING Library Documentation', + [author], 1) +] + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'AdafruitDOTSTAR_FEATHERWINGLibrary', u'Adafruit DOTSTAR_FEATHERWING Library Documentation', + author, 'AdafruitDOTSTAR_FEATHERWINGLibrary', 'One line description of project.', + 'Miscellaneous'), +] diff --git a/dotstar_featherwing.py b/dotstar_featherwing.py new file mode 100644 index 0000000..842cfc5 --- /dev/null +++ b/dotstar_featherwing.py @@ -0,0 +1,242 @@ +# The MIT License (MIT) +# +# Copyright (c) 2017 Dave Astels for ZombieWizard +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +""" +`dotstar_featherwing` - CircuitPython support for the 6x12 DotStar FeatherWing +==================================================== + +Provides a simple way to use the DotStar Feather Wing to display text, images, and animation. + +* Author(s): Dave Astels +""" + +import board +import adafruit_dotstar +import time + +class DotstarFeatherwing: + """Test, Image, and Animation support for the DotStar featherwing""" + + blank_stripe = [(0, 0, 0), + (0, 0, 0), + (0, 0, 0), + (0, 0, 0), + (0, 0, 0), + (0, 0, 0)] + """A blank stripe, used internally to separate characters as they are shifted onto the display.""" + + font_3 = {' ': [ 0, 0, 0], + 'A': [62, 05, 62], + 'B': [63, 37, 26], + 'C': [30, 33, 18], + 'D': [63, 33, 30], + 'E': [63, 37, 33], + 'F': [63, 5, 1], + 'G': [30, 41, 26], + 'H': [63, 4, 63], + 'I': [33, 63, 33], + 'J': [33, 31, 1], + 'K': [63, 4, 59], + 'L': [63, 32, 32], + 'M': [63, 2, 63], + 'N': [63, 12, 63], + 'O': [30, 33, 30], + 'P': [63, 5, 2], + 'Q': [30, 33, 62], + 'R': [63, 5, 58], + 'S': [18, 37, 26], + 'T': [ 1, 63, 1], + 'U': [31, 32, 63], + 'V': [31, 32, 31], + 'W': [63, 16, 63], + 'X': [59, 4, 59], + 'Y': [ 3, 60, 3], + 'Z': [49, 45, 35], + '0': [30, 33, 30], + '1': [34, 63, 32], + '2': [50, 41, 38], + '3': [33, 37, 26], + '4': [ 7, 4, 63], + '5': [23, 37, 25], + '6': [30, 41, 25], + '7': [49, 9, 7], + '8': [26, 37, 26], + '9': [38, 41, 30], + '!': [ 0, 47, 0], + '?': [ 2, 41, 6], + '.': [ 0, 32, 0], + '-': [ 8, 8, 8], + '_': [32, 32, 32], + '+': [ 8, 28, 8], + '/': [48, 12, 3], + '*': [20, 8, 20], + '=': [20, 20, 20], + 'UNKNOWN': [63, 33, 63] } + """A sample font that uses 3 pixel wide characters.""" + + + def __init__(self, clock, data, brightness=1.0): + """Create an interface for the display. + + :param pin clock: The clock pin for the featherwing + :param pin data: The data pin for the featherwing + :param float brightness: Optional brightness (0.0-1.0) that defaults to 1.0 + """ + self.rows = 6 + self.columns = 12 + self.display = adafruit_dotstar.DotStar(clock, data, self.rows * self.columns, brightness, False) + + + def shift_into_left(self, stripe): + """ Shift a column of pixels into the left side of the display. + + :param [int] stripe: A column of pixel colours + """ + for r in range(self.rows): + rightmost = r * self.columns + for c in range(self.columns - 1): + self.display[rightmost + c] = self.display[rightmost + c + 1] + self.display[rightmost + self.columns - 1] = stripe[r] + self.display.show() + + + def shift_into_right(self, stripe): + """ Shift a column of pixels into the rightside of the display. + + :param [int] stripe: A column of pixel colours + """ + for r in range(self.rows): + leftmost = ((r + 1) * self.columns) - 1 + for c in range(self.columns - 1): + self.display[leftmost - c] = self.display[(leftmost - c) -1] + self.display[(leftmost - self.columns) + 1] = stripe[r] + self.display.show() + + + def number_to_pixels(self, x, colour): + """Convert an integer (0..63) into an array of 6 pixels. + + :param int x: integer to convert into binary pixel values; LSB is topmost. + :param (int) colour: the colour to set "on" pixels to + """ + val = x + pixels = [] + for b in range(self.rows): + if val & 1 == 0: + pixels.append((0, 0, 0)) + else: + pixels.append(colour) + val = val >> 1 + return pixels + + + def character_to_numbers(self, font, char): + """Convert a letter to the sequence of column values to display. + + :param {char -> [int]} font: the font to use to convert characters to glyphs + :param char letter: the char to convert + """ + return font[letter] + + + def clear(self): + """Clear the display. + Does NOT update the LEDs + """ + self.display.fill((0,0,0)) + + + def shift_in_character(self, font, c, colour=(0x00, 0x40, 0x00), delay=0.2): + """Shifts a single character onto the display from the right edge. + + :param {char -> [int]} font: the font to use to convert characters to glyphs + :param char c: the char to convert + :param (int) colour: the color to use for each pixel turned on + :param float delay: the time to wait between shifting in columns + """ + if c.upper() in font: + matrix = self.character_to_numbers(font, c.upper()) + else: + matrix = self.character_to_numbers(font, 'UNKNOWN') + for stripe in matrix: + self.shift_into_right(self.number_to_pixels(stripe, colour)) + time.sleep(delay) + self.shift_into_right(self.blank_stripe) + time.sleep(delay) + + + def shift_in_string(self, font, s, colour=(0x00, 0x40, 0x00), delay=0.2): + """Shifts a string onto the display from the right edge. + + :param {char -> [int]} font: the font to use to convert characters to glyphs + :param string s: the char to convert + :param (int) colour: the color to use for each pixel turned on + :param float delay: the time to wait between shifting in columns + """ + for c in s: + self.shift_in_character(font, c, colour, delay) + + + # Display an image + def display_image(self, image, colour): + """Display an mono-coloured image. + + :param [string] image: the textual bitmap, 'X' for set pixels, anything else for others + :param (int) colour: the colour to set "on" pixels to + """ + self.display_coloured_image(image, {'X': colour}) + + + def display_coloured_image(self, image, colours): + """Display an multi-coloured image. + + :param [string] image: the textual bitmap, character are looked up in colours for the + corresponding pixel colour, anything not in the map is off + :param {char -> [int]} colours: a map of characters in the image data to colours to use + """ + for r in range(self.rows): + for c in range(self.columns): + index = r * self.columns + ((self.columns - 1) - c) + key = image[r][c] + if key in colours: + self.display[index] = colours[key] + else: + self.display[index] = (0, 0, 0) + self.display.show() + + + def display_animation(self, animation, colours, delay=0.1): + """Display a multi-coloured animation. + + :param [[string]] animation: a list of textual bitmaps, each as described in display_coloured_image + :param {char -> [int]} colours: a map of characters in the image data to colours to use + :param float delay: the amount of time (seconds) to wait between frames + """ + self.clear() + while True: + for frame in animation: + self.display_coloured_image(frame, colours) + time.sleep(delay) + + + + + diff --git a/examples/count_from_left/main.py b/examples/count_from_left/main.py new file mode 100644 index 0000000..40c5644 --- /dev/null +++ b/examples/count_from_left/main.py @@ -0,0 +1,13 @@ +import board +import dotstar_featherwing +import time + +wing = dotstar_featherwing.DotstarFeatherwing(board.D13, board.D11) + +# count from 0->63, shifting the binary pattern in from the left +while True: + wing.clear() + for x in range(64): + wing.shift_into_left(wing.number_to_pixels(x, (0x40, 0x00, 0x00))) + time.sleep(0.2) + diff --git a/examples/count_from_right/main.py b/examples/count_from_right/main.py new file mode 100644 index 0000000..8df28bf --- /dev/null +++ b/examples/count_from_right/main.py @@ -0,0 +1,13 @@ +import board +import dotstar_featherwing +import time + +wing = dotstar_featherwing.DotstarFeatherwing(board.D13, board.D11) + +# count from 0->63, shifting the binary pattern in from the right +while True: + wing.clear() + for x in range(64): + wing.shift_into_right(wing.number_to_pixels(x, (0x40, 0x00, 0x00))) + time.sleep(0.2) + diff --git a/examples/images/main.py b/examples/images/main.py new file mode 100644 index 0000000..41ff8ff --- /dev/null +++ b/examples/images/main.py @@ -0,0 +1,68 @@ +import board +import dotstar_featherwing +import time + + +wing = dotstar_featherwing.DotstarFeatherwing(board.D13, board.D11) +starfleet = ["XXXXXXX.....", + "..XXXXXXX...", + "....XXXXXXX.", + ".....XXXXXXX", + "....XXXXXXX.", + "..XXXXXXX..."] + +wing.display_image(starfleet, (0x20, 0x20, 0x00)) + +time.sleep(5) + +xmas = ["..y.w......w", + "..G.....w...", + "..G..w....w.", + ".GGG...w....", + "GGGGG.......", + "wwwwwwwwwwww"] + +xmas_colours = {'w': (0x20, 0x20, 0x20), + 'W': (0xFF, 0xFF, 0xFF), + 'G': (0x00, 0x20, 0x00), + 'y': (0x20, 0x20, 0x00), + 'Y': (0xFF, 0xFF, 0x00)} + +wing.display_coloured_image(xmas, xmas_colours) + +time.sleep(5) + + +xmas_animation = [["..y.w......w", + "..G.....w...", + "..G..w....w.", + ".GGG...w....", + "GGGGG.......", + "wwwwwwwwwwww"], + ["..y.........", + "..G.W......w", + "..G.....w...", + ".GGG.w....W.", + "GGGGG..w....", + "wwwwwwwwwwww"], + ["..Y....W....", + "..G.........", + "..G.w......w", + ".GGG....w...", + "GGGGGw....W.", + "wwwwwwwwwwww"], + ["..y..w....w.", + "..G....W....", + "..G.........", + ".GGGW......w", + "GGGGG...w...", + "wwwwwwwwwwww"], + ["..Y.....w...", + "..G..w....W.", + "..G....w....", + ".GGG........", + "GGGGG......W", + "wwwwwwwwwwww"]] + +wing.display_animation(xmas_animation, xmas_colours, 0.05) + diff --git a/examples/shifting_in_string/main.py b/examples/shifting_in_string/main.py new file mode 100644 index 0000000..4bfa4e6 --- /dev/null +++ b/examples/shifting_in_string/main.py @@ -0,0 +1,13 @@ +import board +import dotstar_featherwing +import time + +wing = dotstar_featherwing.DotstarFeatherwing(board.D13, board.D11) + +while True: + wing.clear() + wing.shift_in_string(wing.font_3, "abcdefghijklmnopqrstuvwxyz0123456789!?.-_+/*=@", (0x00, 0x20, 0x20), 0.1) + time.sleep(2) + wing.clear() + wing.shift_in_string(wing.font_3, "hello adafruit discord!", (0x20, 0x00, 0x20), 0.05) + time.sleep(2) diff --git a/readthedocs.yml b/readthedocs.yml new file mode 100644 index 0000000..a3a16c1 --- /dev/null +++ b/readthedocs.yml @@ -0,0 +1,2 @@ +requirements_file: requirements.txt + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..c47d35a --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +adafruit-circuitpython-bus-device