I'll update the guide for the mount syntax change to:
Code: Select all
PrivateMounts=no
Moderators: adafruit_support_bill, adafruit
Code: Select all
PrivateMounts=no
Code: Select all
pi@raspberrypi:~/DotStarPiPainter $ nano DotStarPiPainter.py
GNU nano 5.4 DotStarPiPainter.py
# learn.adafruit.com/adafruit-dotstar-leds/python-circuitpython
# - usbmount:
# sudo apt-get install usbmount
# See file "99_lightpaint_mount" for add'l info.
#
# Written by Phil Burgess / Paint Your Dragon for Adafruit Industries.
#
# Adafruit invests time and resources providing this open source code,
# please support Adafruit and open-source hardware by purchasing products
# from Adafruit!
# --------------------------------------------------------------------------
import os
import select
import signal
import time
import board
import busio
import digitalio
import adafruit_dotstar as dotstar
from evdev import InputDevice, ecodes
from lightpaint import LightPaint
from PIL import Image
# CONFIGURABLE STUFF -------------------------------------------------------
num_leds = 288 # Length of LED strip, in pixels
pin_go = board.D22 # GPIO pin numbers for 'go' button,
pin_next = board.D17 # previous image, next image and speed +/-.
pin_prev = board.D4 # Buttons should connect from these pins to ground.
pin_faster = board.D23
pin_slower = board.D24
vflip = 'true' # 'true' if strip input at bottom, else 'false'
order = dotstar.BGR # BGR for current DotStars, GBR for pre-2015 strips
order2 = 'bgr' # lightpaint lib uses a different syntax for same
spispeed = 12000000 # SPI clock rate...
# 12000000 (12 MHz) is the fastest I could reliably operate a 288-pixel
# strip without glitching. You can try faster, or may need to set it lower,
# no telling.
# DotStar strip data & clock connect to hardware SPI pins (GPIO 10 & 11).
strip = dotstar.DotStar(board.SCK, board.MOSI, num_leds, brightness=1.0,
auto_write=False, pixel_order=order)
# The DotStar library is used for status updates (loading progress, etc.),
# we pull shenanigans here and also access the SPI bus directly for ultra-
# fast strip updates with data out of the lightpaint library.
spi = busio.SPI(board.SCK, MOSI=board.MOSI)
path = '/media/usb' # USB stick mount point
mousefile = '/dev/input/mouse0' # Mouse device (as positional encoder)
eventfile = '/dev/input/event0' # Mouse events accumulate here
dev = None # None unless mouse is detected
gamma = (2.8, 2.8, 2.8) # Gamma correction curves for R,G,B
color_balance = (128, 255, 180) # Max brightness for R,G,B (white balance)
power_settings = (1450, 1550) # Battery avg and peak current
# INITIALIZATION -----------------------------------------------------------
# Set control pins to inputs and enable pull-up resistors.