A simple emulator/simulator for the AdaFruit DotStar Strip Library. This project allows for quicker development of DotStar controller programs that you write, by not requiring you to have hardware hooked up to your device. For example, you can program a Raspberry pi controller from your normal PC using this.
It works in two parts, the emulator application that runs and displays a virtual DotStar Strip, and a spoofed library that you load instead of the AdaFruit Libraries. This allows you to display a virtual Strip on your screen instead of hooking up the hardware during some portion of your development cycle.
DotStar_Emulator has been tested in both Python3.4 and Python 2.7
pip install DotStar_Emulator
- Emulator application. This is a pygame application that will display a representation of your DotStar strip. Seen in the screenshot above.
- Spoofed AdaFruit DotStar_Pi Library or Spoofed AdaFruit Arduino DotStar Library. The purpose of these spoofed libraries is to be a drop in replacement for the AdaFruit Libraries. But instead of sending SPI data to the DotStar Strip in hardware, it will send the data to the DotStar Emulator application.
Quickly start the emulator application with the default configuration, an (8, 8) grid of pixels.
python -M DotStar_Emulator run
However this is only so useful, as you will most likely need to configure the emulator for your setup. The preferred way to do this is to create a working directory where the DotStar_Emulator application can copy some files for you.
From the directory you want to copy the project files to:
python -M DotStar_Emulator init
This will copy two files to the current working directory.
- manage.py, helper utility to quickly start the application and perform some other tasks.
- config.py, edit this file to customize your configuration.
Now you can start the Emulator application using:
python manage.py run
Simply replace the import of the Adafruit_DotStar library for the DotStar_Emulator Adafruit_DotStar library.
Example:
# from dotstar import Adafruit_DotStar
from DotStar_Emulator import Adafruit_DotStar
Or:
# Attempt to import the real library, but if it doesn't exists then
# import the spoofed emulator version.
try:
from dotstar import Adafruit_DotStar
except ImportError:
from DotStar_Emulator import Adafruit_DotStar
Future Release
In the above step a config.py was created in your project working directory. This file is commented with some helpful information for configuring your project. the config.py file will automatically be loaded if its in your current working directory.
set environment varbialbs DOTSTAR_HOST and DOTSTAR_PORT to change the Adafruit_DotStar spoofer library or the test data program included in the emulator.
An example of the Adafruit strandtest.py file is included to demonstrate how easy it is to get up and running. Start an emulator instance with a 8x8 grid, and then run strandtest.py and see the standard strandtest file run on the emualtor.
- Inconsolata-LGC Font, SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007