message: Add another reflection usage

diff:
@@ -16,6 +16,7 @@ use IdeHelper\Annotation\MixinAnnotation;
use IdeHelper\Utility\AppPath;
use RuntimeException;
use Throwable;
+use ReflectionClass;
class ModelAnnotator extends AbstractAnnotator {
@@ -39,8 +40,20 @@ class ModelAnnotator extends AbstractAnnotator {
$modelName = substr($className, 0, -5);
$plugin = $this->getConfig(static::CONFIG_PLUGIN);
+ $tableName = $plugin ? ($plugin . '.' . $modelName) : $modelName;
+ $tableClass = App::className($tableName, 'Model/Table', 'Table');
+
+ $tableReflection = new ReflectionClass($tableClass);
+ if (!$tableReflection->isInstantiable()) {
+ if ($this->getConfig(static::CONFIG_VERBOSE)) {
+ $this->_io->warn(' Skipping table and entity: Not instantiable');
+ }
+
+ return false;
+ }
+
try {
- $table = TableRegistry::get($plugin ? ($plugin . '.' . $modelName) : $modelName);
+ $table = TableRegistry::get($tableName);
$schema = $table->getSchema();
$behaviors = $this->_getBehaviors($table);
} catch (Exception $e) {
@@ -295,11 +308,10 @@ class ModelAnnotator extends AbstractAnnotator {
$behaviors = $this->_extractBehaviors($map);
$parentClass = get_parent_class($table);
- $parentBehaviors = [];
if (isset($this->_cache[$parentClass])) {
$parentBehaviors = $this->_cache[$parentClass];
} else {
- $parentReflection = new \ReflectionClass($parentClass);
+ $parentReflection = new ReflectionClass($parentClass);
if (!$parentReflection->isInstantiable()) {
return $behaviors;
}

diff:
@@ -247,8 +247,7 @@ class ModelAnnotatorTest extends TestCase {
/**
* @return void
*/
- public function testAnnotateProtectedParent()
- {
+ public function testAnnotateProtectedParent() {
$annotator = $this->_getAnnotatorMock([]);
$expectedContent = str_replace("\r\n", "\n", file_get_contents(TEST_FILES . 'Model/Table/BarBarsAbstractTable.php'));
@@ -271,4 +270,5 @@ class ModelAnnotatorTest extends TestCase {
$this->assertTextContains(' -> 14 annotations added', $output);
}
+
}

original_message: Add another reflection usage


message: Another place were abstract tables can be instantiated

change_type: MODIFY

diff:
<?php
namespace IdeHelper\Generator\Task;
+use Cake\Core\App;
use Cake\Core\Configure;
use Cake\Datasource\QueryInterface;
use Cake\ORM\Association;
@@ -69,13 +70,18 @@ class TableFinderTask extends ModelTask {
$allFinders = [];
foreach ($models as $model => $className) {
$customFinders = $this->getFinderMethods($className);
+ $tableClass = App::className($model, 'Model/Table', 'Table');
+
+ $tableReflection = new ReflectionClass($tableClass);
+ if (!$tableReflection->isInstantiable()) {
+ continue;
+ }
try {
$modelObject = TableRegistry::get($model);
$behaviors = $modelObject->behaviors();
$finderMap = $this->invokeProperty($behaviors, '_finderMap');
$customFinders = array_merge($customFinders, array_keys($finderMap));
-
} catch (Exception $exception) {
} catch (Throwable $exception) {
}

license: MIT License

repo: dereuromark/cakephp-ide-helper


message: Fix CS failures

diff:
"dereuromark/cakephp-tools": "^1.9.0",
"dereuromark/cakephp-shim": "^1.8.3",
"squizlabs/php_codesniffer": "^3.4.2",
- "fig-r/psr2r-sniffer": "dev-master"
+ "fig-r/psr2r-sniffer": "dev-master",
+ "phpunit/phpunit": "^5.7.14|^6.0"
},
"autoload": {
"psr-4": {

diff:
@@ -14,9 +14,9 @@ use Exception;
use IdeHelper\Annotation\AnnotationFactory;
use IdeHelper\Annotation\MixinAnnotation;
use IdeHelper\Utility\AppPath;
+use ReflectionClass;
use RuntimeException;
use Throwable;
-use ReflectionClass;
class ModelAnnotator extends AbstractAnnotator {

original_message: Fix CS failures


message: Create Morse_Code_Flasher.py

change_type: ADD

diff:
+# Circuit Playground Express CircuitPython Morse Code Flasher
+# This is meant to work with the Circuit Playground Express board:
+# https://www.adafruit.com/product/3333
+# Needs the NeoPixel module installed:
+# https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel
+# Author: Collin Cunningham
+# License: MIT License (https://opensource.org/licenses/MIT)
+
+import time
+import board
+import neopixel
+
+# Configuration:
+message = 'SOS' # Message to display (capital letters and numbers only)
+dot_length = 0.15 # Duration of one Morse dot
+dash_length = (dot_length * 3.0) # Duration of one Morse dash
+symbol_gap = dot_length # Duration of gap between dot or dash
+character_gap = (dot_length * 3.0) # Duration of gap between characters
+flash_color = (255, 0, 0) # Color of the morse display.
+brightness = 0.5 # Display brightness (0.0 - 1.0)
+morse = [('A', '.-'), ('B', '-...'), ('C', '-.-.'), ('D', '-..'), ('E', '.'), ('F', '..-.'), ('G', '--.'), ('H', '....'), ('I', '..'), ('J', '.---'), ('K', '-.-'), ('L', '.-..'), ('M', '--'), ('N', '-.'), ('O', '---'), ('P', '.--.'), ('Q', '--.-'), ('R', '.-.'), ('S', '...'), ('T', '-'), ('U', '..-'), ('V', '...-'), ('W', '.--'), ('X', '-..-'), ('Y', '-.--'), ('Z', '--..'), ('0', '-----'), ('1', '.----'), ('2', '..---'), ('3', '...--'), ('4', '....-'), ('5', '.....'), ('6', '-....'), ('7', '--...'), ('8', '---..'), ('9', '----.')]
+
+# Define a class that represents the morse flasher.
+class MorseFlasher:
+
+ def __init__(self, color=(255,255,255)):
+ #set the color adjusted for brightness
+ self._color = (int(color[0]*brightness), int(color[1]*brightness), int(color[2]*brightness))
+
+ def light(self, on=True):
+ if on:
+ pixels.fill(self._color)
+ else:
+ pixels.fill((0,0,0))
+ pixels.show()
+
+ def display(self, code=".-.-.- "):
+ # iterate through morse code symbols
+ for c in code:
+ # show a dot
+ if c == ".":
+ self.showDot()
+ # show a dash
+ elif c == "-":
+ self.showDash()
+ # show a gap
+ elif c == " ":
+ time.sleep(character_gap)
+
+ def showDot(self):
+ self.light(True)
+ time.sleep(dot_length)
+ self.light(False)
+ time.sleep(symbol_gap)
+
+ def showDash(self):
+ self.light(True)
+ time.sleep(dash_length)
+ self.light(False)
+ time.sleep(symbol_gap)
+
+ def encode(self, str):
+ output = ""
+ #iterate through string's characters
+ for c in str:
+ #find morse code for a character
+ for x in morse:
+ if x[0] == c:
+ #add code to output
+ output += x[1]
+ # add a space in between characters
+ output += " "
+ #save complete morse code output to display
+ self.display(output)
+
+# Initialize NeoPixels
+pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, auto_write=False)
+pixels.fill((0, 0, 0))
+pixels.show()
+
+# Create a morse flasher object.
+flasher = MorseFlasher(flash_color)
+
+# Main loop will run forever
+while True:
+ flasher.encode(message)

original_message: Create Morse_Code_Flasher.py


message:
Update main.py
change function ordering for better legibility

diff:
@@ -34,19 +34,6 @@ class MorseFlasher:
pixels.fill((0,0,0))
pixels.show()
- def display(self, code=".-.-.- "):
- # iterate through morse code symbols
- for c in code:
- # show a dot
- if c == ".":
- self.showDot()
- # show a dash
- elif c == "-":
- self.showDash()
- # show a gap
- elif c == " ":
- time.sleep(character_gap)
-
def showDot(self):
self.light(True)
time.sleep(dot_length)
@@ -73,6 +60,19 @@ class MorseFlasher:
#save complete morse code output to display
self.display(output)
+ def display(self, code=".-.-.- "):
+ # iterate through morse code symbols
+ for c in code:
+ # show a dot
+ if c == ".":
+ self.showDot()
+ # show a dash
+ elif c == "-":
+ self.showDash()
+ # show a gap
+ elif c == " ":
+ time.sleep(character_gap)
+
# Initialize NeoPixels
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, auto_write=False)
pixels.fill((0, 0, 0))


message: Added Labo Piano Light FX

new_path: Labo Piano Light FX/code.py

diff:
+import board
+import neopixel
+import time
+from analogio import AnalogIn
+import array
+
+n_pixels = 10 # Number of pixels you are using
+dc_offset = 0 # DC offset in mic signal - if unusure, leave 0
+noise = 100 # Noise/hum/interference in mic signal
+lvl = 10 # Current "dampened" audio level
+maxbrt = 127 # Maximum brightness of the neopixels (0-255)
+wheelStart = 0 # Start of the RGB spectrum we'll use
+wheelEnd = 255 # End of the RGB spectrum we'll use
+
+mic_pin = AnalogIn(board.A7)
+
+# Set up NeoPixels and turn them all off.
+strip = neopixel.NeoPixel(board.NEOPIXEL, n_pixels, brightness=0.1, auto_write=False)
+strip.fill(0)
+strip.show()
+
+def wheel(pos):
+ # Input a value 0 to 255 to get a color value.
+ # The colours are a transition r - g - b - back to r.
+ if (pos < 0) or (pos > 255):
+ return (0, 0, 0)
+ if (pos < 85):
+ return (int(pos * 3), int(255 - (pos*3)), 0)
+ elif (pos < 170):
+ pos -= 85
+ return (int(255 - pos*3), 0, int(pos*3))
+ else:
+ pos -= 170
+ return (0, int(pos*3), int(255 - pos*3))
+
+def remapRangeSafe(value, leftMin, leftMax, rightMin, rightMax):
+ # this remaps a value from original (left) range to new (right) range
+
+ # Force the input value to within left min & max
+ if value < leftMin: value = leftMin
+ if value > leftMax: value = leftMax
+
+ # Figure out how 'wide' each range is
+ leftSpan = leftMax - leftMin
+ rightSpan = rightMax - rightMin
+
+ # Convert the left range into a 0-1 range (int)
+ valueScaled = int(value - leftMin) / int(leftSpan)
+
+ # Convert the 0-1 range into a value in the right range.
+ return int(rightMin + (valueScaled * rightSpan))
+
+while True:
+ n = int ( ( mic_pin.value / 65536 ) * 1000 ) # 10-bit ADC format
+ n = abs(n - 512 - dc_offset) # Center on zero
+
+ if ( n >= noise ): # Remove noise/hum
+ n = n - noise
+
+ lvl = int ( ( (lvl * 7) + n ) / 8 ) # "Dampened" reading (else looks twitchy) - divide by 8 (2^3)
+
+ # Color pixels based on rainbow gradient
+ vlvl = remapRangeSafe(lvl, 0, 255, wheelStart, wheelEnd)
+ for i in range(0, len(strip)):
+ strip[i] = wheel(vlvl)
+ # Set strip brightness based on audio level
+ strip.brightness = float(remapRangeSafe(lvl,50,255,0,maxbrt))/255.0
+ strip.show()

original_message: Added Labo Piano Light FX


message: Added Labo RC Car Light FX

diff:
+from adafruit_circuitplayground.express import cpx
+import board
+import neopixel
+
+pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=0.1, auto_write=True)
+pixels.fill(0)
+
+while True:
+
+ x_float, y_float, z_float = cpx.acceleration # read acceleromter
+ r, g, b = 0, 0, 0
+
+ if abs(x_float) > 4.0:
+ r = 255
+ if abs(y_float) > 2.0:
+ g = 255
+ if z_float > -6.0 or z_float < -12.0:
+ b = 255
+
+ pixels.fill((r,g,b))
+
\ No newline at end of file

original_message: Added Labo RC Car Light FX


message: Format Trinket Ultrasonic Rangefinder

diff:
# * LV-EZ1 Ultrasonic Sensor PW pin to Trinket GPIO #1
# * Backlight can be hard wired by connecting LCD pin 16, 17 or 18 to GND
+import time
+
+import adafruit_character_lcd
import board
import busio
-import time
import pulseio
-import adafruit_character_lcd
ez1pin = board.D1 # Trinket GPIO #1
@@ -43,65 +44,76 @@ rangevalue = [0, 0, 0, 0, 0, 0, 0, 0, 0]
# 25ms sensor power up pause
time.sleep(.25)
-# EZ1 ultrasonic sensor is measuring "time of flight"
-# * convert time of flight into distance
-# * centimeters (divide by 58mS)
-# * inches (divide by 147mS)
-# * centimeter is default output, flip comments for inches
-def tof_to_distance(tof):
-# convert_to_inches = 147
- convert_to_cm = 58
-# inches = tof / convert_to_inches
+def tof_cm(tof):
+ """
+ EZ1 ultrasonic sensor is measuring "time of flight"
+ Converts time of flight into distance in centimeters
+ """
+ convert_to_cm = 58
cm = tof / convert_to_cm
-# return inches
return cm
-# find the mode (most common value reported)
-# will return median (center of sorted list)
-# should mode not be found
-def mode(x, n):
- maxcount = 0
+def tof_inches(tof):
+ """
+ EZ1 ultrasonic sensor is measuring "time of flight"
+ Converts time of flight into distance in inches
+ """
+ convert_to_inches = 147
+ inches = tof / convert_to_inches
+
+ return inches
+
+
+def find_mode(x):
+ """
+ find the mode (most common value reported)
+ will return median (center of sorted list)
+ should mode not be found
+ """
+ n = len(x)
+
+ max_count = 0
mode = 0
bimodal = 0
- prevcount = 0
counter = 0
- i = 0
+ index = 0
- while ( i < ( n - 1 ) ):
- prevcount = counter
+ while index < (n - 1):
+ prev_count = counter
counter = 0
- while ( ( x[i] ) == ( x[i+1] ) ):
+ while (x[index]) == (x[index + 1]):
counter += 1
- i += 1
+ index += 1
- if ( ( counter > prevcount ) and ( counter > maxcount ) ):
- mode = x[i]
- maxcount = counter
+ if (counter > prev_count) and (counter > max_count):
+ mode = x[index]
+ max_count = counter
bimodal = 0
- if ( counter == 0 ):
- i += 1
+ if counter == 0:
+ index += 1
# If the dataset has 2 or more modes.
- if ( counter == maxcount ):
+ if counter == max_count:
bimodal = 1
# Return the median if there is no mode.
- if ( ( mode == 0 ) or ( bimodal == 1 ) ):
+ if (mode == 0) or (bimodal == 1):
mode = x[int(n / 2)]
return mode
+
while True:
# wait between samples
time.sleep(.5)
- if ( len(pulses) == samples ):
+ if len(pulses) == samples:
j = 0 # rangevalue array counter
# only save the values within range
@@ -110,12 +122,11 @@ while True:
for i in range(0, samples):
tof = pulses[i] # time of flight - PWM HIGH
- if ( ( tof > 880 ) and ( tof < 37500 ) ):
- if ( j < len(rangevalue) ):
- rangevalue[j] = tof_to_distance(tof)
+ if 880 < tof < 37500:
+ if j < len(rangevalue):
+ rangevalue[j] = tof_cm(tof)
j += 1
-
# clear pulse samples
pulses.clear() # clear all values in pulses[]
@@ -123,7 +134,7 @@ while True:
rangevalue = sorted(rangevalue)
# returns mode or median
- mode_result = int(mode(rangevalue, len(rangevalue)))
+ mode_result = int(find_mode(rangevalue))
# python console prints both centimeter and inches distance
cm2in = .393701

original_message: Format Trinket Ultrasonic Rangefinder


message: Format Gemma Space Invader Pendant

diff:
-import board
import time
-import busio as io
+
import adafruit_ht16k33.matrix
+import board
+import busio as io
import touchio
touch = touchio.TouchIn(board.D1)
@@ -106,7 +107,6 @@ anim = [
[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0]]
]
-
#
# run until we are out of animation frames
# use Gemma's built-in reset button or switch to restart
@@ -114,7 +114,7 @@ anim = [
# populate matrix
while True:
- if ( frame_count < len(anim) ):
+ if frame_count < len(anim):
for x in range(xpix):
for y in range(ypix):
matrix.pixel(x, y, anim[frame_count][x][y])
@@ -136,5 +136,5 @@ while True:
# A0/D1 pin has been touched
# reset animation
- if ( touch.value ):
+ if touch.value:
frame_count = 0

original_message: Format Gemma Space Invader Pendant


message: Format Trinket Gemma Servo Control

diff:
-import time
import board
-from analogio import AnalogIn
import simpleio
+from analogio import AnalogIn
# servo pin for the M0 boards:
servo = simpleio.Servo(board.A2)
@@ -10,19 +9,21 @@ angle = 0
# potentiometer
trimpot = AnalogIn(board.A1) # pot pin for servo control
-def remapRange(value, leftMin, leftMax, rightMin, rightMax):
+
+def remap_range(value, left_min, left_max, right_min, right_max):
# this remaps a value from original (left) range to new (right) range
# Figure out how 'wide' each range is
- leftSpan = leftMax - leftMin
- rightSpan = rightMax - rightMin
+ left_span = left_max - left_min
+ right_span = right_max - right_min
# Convert the left range into a 0-1 range (int)
- valueScaled = int(value - leftMin) / int(leftSpan)
+ value_scaled = int(value - left_min) / int(left_span)
# Convert the 0-1 range into a value in the right range.
- return int(rightMin + (valueScaled * rightSpan))
+ return int(right_min + (value_scaled * right_span))
+
while True:
- angle = remapRange(trimpot.value, 0, 65535, 0, 180)
+ angle = remap_range(trimpot.value, 0, 65535, 0, 180)
servo.angle = angle
# time.sleep(0.05)

original_message: Format Trinket Gemma Servo Control


message: Format for PyLint

diff:
-# This Code uses the:
-# * Adafruit LCD backpack using MCP23008 I2C expander
-# * Maxbotic LV-EZ1 Ultrasonic Sensor
-#
-# Tested with the Trinket M0
-# The ultrasonic sensor and pin use should be Gemma M0 compatible
-# This sketch reads the LV-EZ1 by pulse count
-# Then prints the distance to the LCD and python console
-#
-# The circuit:
-# * 5V to Trinket M0 USB or BAT pin, I2C Backpack 5V and EZ1 +5
-# * GND to Trinket M0 GND pin, I2C Backpack GND and EZ1 GND
-# * Display I2C Backpack SLK to Trinket GPIO #2
-# * Display I2C backpack SDA to Trinket GPIO #0
-# * LV-EZ1 Ultrasonic Sensor PW pin to Trinket GPIO #1
-# * Backlight can be hard wired by connecting LCD pin 16, 17 or 18 to GND
+"""
+This Code uses the:
+* Adafruit LCD backpack using MCP23008 I2C expander
+* Maxbotic LV-EZ1 Ultrasonic Sensor
+
+Tested with the Trinket M0
+The ultrasonic sensor and pin use should be Gemma M0 compatible
+This sketch reads the LV-EZ1 by pulse count
+Then prints the distance to the LCD and python console
+
+The circuit:
+* 5V to Trinket M0 USB or BAT pin, I2C Backpack 5V and EZ1 +5
+* GND to Trinket M0 GND pin, I2C Backpack GND and EZ1 GND
+* Display I2C Backpack SLK to Trinket GPIO #2
+* Display I2C backpack SDA to Trinket GPIO #0
+* LV-EZ1 Ultrasonic Sensor PW pin to Trinket GPIO #1
+* Backlight can be hard wired by connecting LCD pin 16, 17 or 18 to GND
+"""
import time
@@ -45,24 +47,24 @@ rangevalue = [0, 0, 0, 0, 0, 0, 0, 0, 0]
time.sleep(.25)
-def tof_cm(tof):
+def tof_cm(time_of_flight):
"""
EZ1 ultrasonic sensor is measuring "time of flight"
Converts time of flight into distance in centimeters
"""
convert_to_cm = 58
- cm = tof / convert_to_cm
+ cm = time_of_flight / convert_to_cm
return cm
-def tof_inches(tof):
+def tof_inches(time_of_flight):
"""
EZ1 ultrasonic sensor is measuring "time of flight"
Converts time of flight into distance in inches
"""
convert_to_inches = 147
- inches = tof / convert_to_inches
+ inches = time_of_flight / convert_to_inches
return inches

original_message: Format for PyLint


message: Format Space Invader Pendant for PyLint

diff:
@@ -11,7 +11,7 @@ i2c = io.I2C(board.SCL, board.SDA)
matrix = adafruit_ht16k33.matrix.Matrix8x8(i2c)
# pixels initializers
-xpix = ypix = 8
+x_pix = y_pix = 8
x = y = 0
matrix.fill(0)
matrix.show()
@@ -24,7 +24,7 @@ frame_delay = [.25, .25, .25, .25, .25, .25, .25, .25, .25, .25, .25, .25,
frame_count = 0
# animation bitmaps
-anim = [
+animation = [
# frame 0 - alien #1 frame 1
[[0, 0, 0, 1, 1, 0, 0, 0], [0, 0, 1, 1, 1, 1, 0, 0], [0, 1, 1, 1, 1, 1, 1, 0],
[1, 1, 0, 1, 1, 0, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1], [0, 0, 1, 0, 0, 1, 0, 0],
@@ -114,10 +114,10 @@ anim = [
# populate matrix
while True:
- if frame_count < len(anim):
- for x in range(xpix):
- for y in range(ypix):
- matrix.pixel(x, y, anim[frame_count][x][y])
+ if frame_count < len(animation):
+ for x in range(x_pix):
+ for y in range(y_pix):
+ matrix.pixel(x, y, animation[frame_count][x][y])
# next animation frame
frame_count += 1

original_message: Format Space Invader Pendant for PyLint


message: Format Mini Theramin

diff:
-# Adafruit Trinket/Gemma Example: Simple Theramin
-# Read the voltage from a Cadmium Sulfide (CdS) photocell voltage
-# divider and output a corresponding tone to a piezo buzzer
-#
-# Photocell voltage divider center wire to GPIO #2 (analog 1)
-# and output tone to GPIO #0 (digital 0)
+"""
+Adafruit Trinket/Gemma Example: Simple Theramin
+Read the voltage from a Cadmium Sulfide (CdS) photocell voltage
+divider and output a corresponding tone to a piezo buzzer
+Photocell voltage divider center wire to GPIO #2 (analog 1)
+and output tone to GPIO #0 (digital 0)
+"""
+
+import time
+
+import analogio
import board
import pulseio
-import analogio
-import time
photocell_pin = board.A1 # CdS photocell connected to this ANALOG pin
speaker_pin = board.D0 # Speaker is connected to this DIGITAL pin

original_message: Format Mini Theramin


message: Format Blinky Eyes

diff:
-# Name: Blinking Eyes - based on code by Brad Blumenthal, MAKE Magazine
-# License: GPLv3
-# 2013 - Adafruit Learning System - Modified for 8 MHz ATTiny85 and low light photocell
-# 2018 - Adafruit Learning System - Modified for Gemma M0 and Circuit Python
+"""
+Blinking Eyes - based on code by Brad Blumenthal, MAKE Magazine
+License: GPLv3
+"""
-import board
-import analogio
import time
+
+import analogio
+import board
import pulseio
try:
@@ -36,16 +37,16 @@ blink_freq_max = 6
while True:
# turn on LEDs if it is dark out
- if ( photocell.value < darkness_max ):
+ if photocell.value < darkness_max:
# blink frequency and timer
- if ( blink_delay ):
+ if blink_delay:
blink_delay = False
blink_timer_start = time.monotonic()
blink_freq = random.randint(blink_freq_min, blink_freq_max)
# time to blink? Blink once every 3 - 6 seconds (random assingment)
- if ( ( time.monotonic() - blink_timer_start ) >= blink_freq ):
+ if (time.monotonic() - blink_timer_start) >= blink_freq:
blink_delay = True
pwm.duty_cycle = 0
time.sleep(.1)
@@ -57,10 +58,10 @@ while True:
brightness = brightness + fade_amount
# reverse the direction of the fading at the ends of the fade:
- if ( brightness <= 0 ):
+ if brightness <= 0:
fade_amount = -fade_amount
counter += 1
- elif ( brightness >= 65535 ):
+ elif brightness >= 65535:
fade_amount = -fade_amount
counter += 1

original_message: Format Blinky Eyes


message: Format Textile Potentiometer

diff:
-import board
import analogio
-import time
+import board
import neopixel
# Initialize input/output pins
-sensorpin = board.A1 # input pin for the potentiometer
-sensor = analogio.AnalogIn(sensorpin)
+sensor_pin = board.A1 # input pin for the potentiometer
+sensor = analogio.AnalogIn(sensor_pin)
+
+pix_pin = board.D1 # pin where NeoPixels are connected
+num_pix = 8 # number of neopixels
+strip = neopixel.NeoPixel(pix_pin, num_pix, brightness=.15, auto_write=False)
-pixpin = board.D1 # pin where NeoPixels are connected
-numpix = 8 # number of neopixels
-strip = neopixel.NeoPixel(pixpin, numpix, brightness=.15, auto_write=False)
+color_value = 0
+sensor_value = 0
-colorvalue = 0
-sensorvalue = 0
def wheel(pos):
# Input a value 0 to 255 to get a color value.
# The colours are a transition r - g - b - back to r.
if (pos < 0) or (pos > 255):
- return (0, 0, 0)
- if (pos < 85):
- return (int(pos * 3), int(255 - (pos*3)), 0)
- elif (pos < 170):
+ return 0, 0, 0
+ if pos < 85:
+ return int(pos * 3), int(255 - (pos * 3)), 0
+ elif pos < 170:
pos -= 85
- return (int(255 - pos*3), 0, int(pos*3))
- else:
+ return int(255 - pos * 3), 0, int(pos * 3)
+
pos -= 170
- return (0, int(pos*3), int(255 - pos*3))
+ return 0, int(pos * 3), int(255 - pos * 3)
+
-def remapRange(value, leftMin, leftMax, rightMin, rightMax):
+def remap_range(value, left_min, left_max, right_min, right_max):
# this remaps a value from original (left) range to new (right) range
# Figure out how 'wide' each range is
- leftSpan = leftMax - leftMin
- rightSpan = rightMax - rightMin
+ left_span = left_max - left_min
+ right_span = right_max - right_min
# Convert the left range into a 0-1 range (int)
- valueScaled = int(value - leftMin) / int(leftSpan)
+ valueScaled = int(value - left_min) / int(left_span)
# Convert the 0-1 range into a value in the right range.
- return int(rightMin + (valueScaled * rightSpan))
+ return int(right_min + (valueScaled * right_span))
+
# Loop forever...
while True:
# remap the potentiometer analog sensor values from 0-65535 to RGB 0-255
- colorvalue = remapRange(sensor.value, 0, 65535, 0, 255)
+ color_value = remap_range(sensor.value, 0, 65535, 0, 255)
- for i in range( 0, len(strip) ):
- strip[i] = wheel(colorvalue)
+ for i in range(len(strip)):
+ strip[i] = wheel(color_value)
strip.write()

original_message: Format Textile Potentiometer


message: Format superhero power plant

diff:
import board
import neopixel
-import time
+
try:
import urandom as random # for v1.0 API support
except ImportError:
import random
-numpix = 17 # Number of NeoPixels
-pixpin = board.D1 # Pin where NeoPixels are connected
-strip = neopixel.NeoPixel(pixpin, numpix)
+num_pix = 17 # Number of NeoPixels
+pix_pin = board.D1 # Pin where NeoPixels are connected
+strip = neopixel.NeoPixel(pix_pin, num_pix)
-minAlpha = 0.1 # Minimum brightness
-maxAlpha = 0.4 # Maximum brightness
-alpha = (minAlpha + maxAlpha) / 2 # Start in middle
-alphaDelta = 0.01 # Amount to change brightness each time through loop
-alphaUp = True # If True, brightness increasing, else decreasing
+min_alpha = 0.1 # Minimum brightness
+max_alpha = 0.4 # Maximum brightness
+alpha = (min_alpha + max_alpha) / 2 # Start in middle
+alpha_delta = 0.01 # Amount to change brightness each time through loop
+alpha_up = True # If True, brightness increasing, else decreasing
strip.fill([0, 0, 255]) # Fill blue, or change to R,G,B of your liking
while True: # Loop forever...
if random.randint(1, 5) == 5: # 1-in-5 random chance
- alphaUp = not alphaUp # of reversing direction
- if alphaUp: # Increasing brightness?
- alpha += alphaDelta # Add some amount
- if alpha >= maxAlpha: # At or above max?
- alpha = maxAlpha # Limit to max
- alphaUp = False # and switch direction
+ alpha_up = not alpha_up # of reversing direction
+ if alpha_up: # Increasing brightness?
+ alpha += alpha_delta # Add some amount
+ if alpha >= max_alpha: # At or above max?
+ alpha = max_alpha # Limit to max
+ alpha_up = False # and switch direction
else: # Else decreasing brightness
- alpha -= alphaDelta # Subtract some amount
- if alpha <= minAlpha: # At or below min?
- alpha = minAlpha # Limit to min
- alphaUp = True # and switch direction
+ alpha -= alpha_delta # Subtract some amount
+ if alpha <= min_alpha: # At or below min?
+ alpha = min_alpha # Limit to min
+ alpha_up = True # and switch direction
strip.brightness = alpha # Set brightness to 0.0 to 1.0
strip.write() # and issue data to LED strip

original_message: Format superhero power plant


message: Format Theme Songs

diff:
-# Plays the 007 theme song
-# Gemma M0 with Piezo on D0 and GND
+"""
+Plays the 007 theme song
+Gemma M0 with Piezo on D0 and GND
+"""
-import pulseio
-import board
import time
+import board
+import pulseio
+
piezo = pulseio.PWMOut(board.D0, duty_cycle=0, frequency=440,
variable_frequency=True)
@@ -129,7 +132,6 @@ Bond03=[[E3, eighth_note],
[Fs3, eighth_note],
[Fs3, eighth_note]]
-
Bond04 = [[E3, eighth_note],
[G3, sixteenth_note],
[G3, sixteenth_note],
@@ -231,14 +233,16 @@ Bond12=[[E3, eighth_note],
[rst, quarter_note],
[Fs4, whole_note]]
+
def song_playback(song):
- for n in range(len(song)):
- piezo.frequency = (song[n][0])
+ for note in song:
+ piezo.frequency = (note[0])
piezo.duty_cycle = 65536 // 2 # on 50%
- time.sleep(song[n][1]) # note duration
+ time.sleep(note[1]) # note duration
piezo.duty_cycle = 0 # off
time.sleep(0.01)
+
# this plays the full song roadmap
song_playback(Bond01)
song_playback(Bond01)

diff:
-# Plays the Carmen Sandiego theme song
-# Gemma M0 with Piezo on D0 and GND
+"""
+Plays the Carmen Sandiego theme song
+Gemma M0 with Piezo on D0 and GND
+"""
-import pulseio
-import board
import time
+import board
+import pulseio
+
piezo = pulseio.PWMOut(board.D0, duty_cycle=0, frequency=440,
variable_frequency=True)
@@ -186,6 +189,7 @@ carmen08 =[[Fs4, eighth_note],
[Fs3, eighth_note],
[rst, quarter_note]]
+
def song_playback(song):
for n in range(len(song)):
piezo.frequency = (song[n][0])

original_message: Format Theme Songs


message: Format Space Face LED

diff:
-from digitalio import DigitalInOut, Direction
+import time
+
import board
import neopixel
-import time
+from digitalio import DigitalInOut, Direction
-pixpin = board.D1
-numpix = 5
+pix_pin = board.D1
+num_pix = 5
led = DigitalInOut(board.D13)
led.direction = Direction.OUTPUT
-strip = neopixel.NeoPixel(pixpin, numpix, brightness=1, auto_write=True)
+strip = neopixel.NeoPixel(pix_pin, num_pix, brightness=1, auto_write=True)
+
-def colorWipe(color, wait):
+def color_wipe(color, wait):
for j in range(len(strip)):
strip[j] = (color)
time.sleep(wait)
+
while True:
- colorWipe( (50, 0, 50), .1 ) # Purple LEDs
+ color_wipe((50, 0, 50), .1) # Purple LEDs

original_message: Format Space Face LED


message: Format sound reactive neopixel peace pendant

diff:
+import array
+
import board
import neopixel
-import time
from analogio import AnalogIn
-import array
led_pin = board.D0 # NeoPixel LED strand is connected to GPIO #0 / D0
n_pixels = 12 # Number of pixels you are using
@@ -12,12 +12,12 @@ samples = 60 # Length of buffer for dynamic level adjustment
top = n_pixels + 1 # Allow dot to go slightly off scale
peak = 0 # Used for falling dot
-dotcount = 0 # Frame counter for delaying dot-falling speed
-volcount = 0 # Frame counter for storing past volume data
+dot_count = 0 # Frame counter for delaying dot-falling speed
+vol_count = 0 # Frame counter for storing past volume data
lvl = 10 # Current "dampened" audio level
-minlvlavg = 0 # For dynamic adjustment of graph low & high
-maxlvlavg = 512
+min_level_avg = 0 # For dynamic adjustment of graph low & high
+max_level_avg = 512
# Collection of prior volume samples
vol = array.array('H', [0] * samples)
@@ -26,21 +26,23 @@ mic_pin = AnalogIn(board.A1)
strip = neopixel.NeoPixel(led_pin, n_pixels, brightness=.1, auto_write=True)
+
def wheel(pos):
# Input a value 0 to 255 to get a color value.
# The colours are a transition r - g - b - back to r.
if (pos < 0) or (pos > 255):
return (0, 0, 0)
- if (pos < 85):
+ if pos < 85:
return (int(pos * 3), int(255 - (pos * 3)), 0)
- elif (pos < 170):
+ elif pos < 170:
pos -= 85
return (int(255 - pos * 3), 0, int(pos * 3))
else:
pos -= 170
return (0, int(pos * 3), int(255 - pos * 3))
-def remapRange(value, leftMin, leftMax, rightMin, rightMax):
+
+def remap_range(value, leftMin, leftMax, rightMin, rightMax):
# this remaps a value from original (left) range to new (right) range
# Figure out how 'wide' each range is
leftSpan = leftMax - leftMin
@@ -52,51 +54,54 @@ def remapRange(value, leftMin, leftMax, rightMin, rightMax):
# Convert the 0-1 range into a value in the right range.
return int(rightMin + (valueScaled * rightSpan))
+
while True:
n = int((mic_pin.value / 65536) * 1000) # 10-bit ADC format
n = abs(n - 512 - dc_offset) # Center on zero
- if ( n >= noise ): # Remove noise/hum
+ if n >= noise: # Remove noise/hum
n = n - noise
lvl = int(((lvl * 7) + n) / 8) # "Dampened" reading (else looks twitchy) - divide by 8 (2^3)
# Calculate bar height based on dynamic min/max levels (fixed point):
- height = top * (lvl - minlvlavg) / (maxlvlavg - minlvlavg)
+ height = top * (lvl - min_level_avg) / (max_level_avg - min_level_avg)
# Clip output
- if(height < 0):
+ if height < 0:
height = 0
- elif (height > top):
+ elif height > top:
height = top
# Keep 'peak' dot at top
- if(height > peak):
+ if height > peak:
peak = height
# Color pixels based on rainbow gradient
for i in range(0, len(strip)):
- if (i >= height):
+ if i >= height:
strip[i] = [0, 0, 0]
else:
- strip[i] = wheel(remapRange(i, 0, (n_pixels - 1), 30, 150))
+ strip[i] = wheel(remap_range(i, 0, (n_pixels - 1), 30, 150))
# Save sample for dynamic leveling
- vol[volcount] = n
+ vol[vol_count] = n
# Advance/rollover sample counter
- if (++volcount >= samples):
- volcount = 0
+ vol_count += 1
+
+ if vol_count >= samples:
+ vol_count = 0
# Get volume range of prior frames
- minlvl = vol[0]
- maxlvl = vol[0]
+ min_level = vol[0]
+ max_level = vol[0]
for i in range(1, len(vol)):
- if(vol[i] < minlvl):
- minlvl = vol[i]
- elif (vol[i] > maxlvl):
- maxlvl = vol[i]
+ if vol[i] < min_level:
+ min_level = vol[i]
+ elif vol[i] > max_level:
+ max_level = vol[i]
# minlvl and maxlvl indicate the volume range over prior frames, used
# for vertically scaling the output graph (so it looks interesting
@@ -104,11 +109,10 @@ while True:
# (e.g. at very low volume levels) the graph becomes super coarse
# and 'jumpy'...so keep some minimum distance between them (this
# also lets the graph go to zero when no sound is playing):
- if( (maxlvl - minlvl) < top ):
- maxlvl = minlvl + top
+ if (max_level - min_level) < top:
+ max_level = min_level + top
- minlvlavg = ( minlvlavg * 63 + minlvl ) >> 6 # Dampen min/max levels - divide by 64 (2^6)
- maxlvlavg = ( maxlvlavg * 63 + maxlvl ) >> 6 # fake rolling average - divide by 64 (2^6)
+ min_level_avg = (min_level_avg * 63 + min_level) >> 6 # Dampen min/max levels - divide by 64 (2^6)
+ max_level_avg = (max_level_avg * 63 + max_level) >> 6 # fake rolling average - divide by 64 (2^6)
print(n)
-


message: Format Snow Globe

diff:
-# Snow Globe
-# for Adafruit Circuit Playground express
-# with CircuitPython
+"""Snow Globe for Adafruit Circuit Playground express with CircuitPython """
-from adafruit_circuitplayground.express import cpx
import math
import time
+from adafruit_circuitplayground.express import cpx
+
ROLL_THRESHOLD = 30 # Total acceleration
cpx.pixels.brightness = 0.1 # set brightness value
@@ -21,7 +20,8 @@ new_roll = False
rolling = False
-def fade_pixels(fade_color): # pick from colors defined above, e.g., RED, GREEN, BLUE, WHITE, etc.
+# pick from colors defined above, e.g., RED, GREEN, BLUE, WHITE, etc.
+def fade_pixels(fade_color):
# fade up
for j in range(25):
pixel_brightness = (j * 0.01)
@@ -36,6 +36,7 @@ def fade_pixels(fade_color): # pick from colors defined above, e.g., RED, GREEN
for i in range(10):
cpx.pixels[i] = fade_color
+
# fade in the pixels
fade_pixels(GREEN)
@@ -53,49 +54,64 @@ def play_song(song_number):
eighth_note = whole_note / 8
# set up note values
- A3 = 220
- Bb3 = 233
- B3 = 247
+ # A3 = 220
+ # Bb3 = 233
+ # B3 = 247
C4 = 262
- Db4 = 277
+ # Db4 = 277
D4 = 294
- Eb4 = 311
+ # Eb4 = 311
E4 = 330
F4 = 349
- Gb4 = 370
+ # Gb4 = 370
G4 = 392
- Ab4 = 415
+ # Ab4 = 415
A4 = 440
- Bb4 = 466
+ # Bb4 = 466
B4 = 494
if song_number == 1:
# jingle bells
- jingle_bells_song = [[E4, quarter_note], [E4, quarter_note],
- [E4, half_note], [E4, quarter_note], [E4, quarter_note],
- [E4, half_note], [E4, quarter_note], [G4, quarter_note],
- [C4, dotted_quarter_note], [D4, eighth_note], [E4, whole_note]]
+ jingle_bells_song = [
+ [E4, quarter_note],
+ [E4, quarter_note],
+ [E4, half_note],
+ [E4, quarter_note],
+ [E4, quarter_note],
+ [E4, half_note],
+ [E4, quarter_note],
+ [G4, quarter_note],
+ [C4, dotted_quarter_note],
+ [D4, eighth_note],
+ [E4, whole_note],
+ ]
for n in range(len(jingle_bells_song)):
cpx.start_tone(jingle_bells_song[n][0])
time.sleep(jingle_bells_song[n][1])
cpx.stop_tone()
-
if song_number == 2:
# Let It Snow
- let_it_snow_song = [[B4, dotted_quarter_note], [A4, eighth_note],
- [G4, quarter_note], [G4, dotted_quarter_note], [F4, eighth_note],
- [E4, quarter_note], [E4, dotted_quarter_note], [D4, eighth_note],
- [C4, whole_note]]
+ let_it_snow_song = [
+ [B4, dotted_quarter_note],
+ [A4, eighth_note],
+ [G4, quarter_note],
+ [G4, dotted_quarter_note],
+ [F4, eighth_note],
+ [E4, quarter_note],
+ [E4, dotted_quarter_note],
+ [D4, eighth_note],
+ [C4, whole_note],
+ ]
for n in range(len(let_it_snow_song)):
cpx.start_tone(let_it_snow_song[n][0])
time.sleep(let_it_snow_song[n][1])
cpx.stop_tone()
-play_song(1) # play music on start
+play_song(1) # play music on start
# Loop forever
while True:
@@ -114,7 +130,8 @@ while True:
y_total = y_total / 10
z_total = z_total / 10
- total_accel = math.sqrt(x_total*x_total + y_total*y_total + z_total*z_total)
+ total_accel = math.sqrt(x_total * x_total + y_total *
+ y_total + z_total * z_total)
# Check for rolling
if total_accel > ROLL_THRESHOLD:

original_message: Format Snow Globe


message: Format Sensor Plotting

diff:
-import digitalio
-import board
import time
+import board
+import digitalio
+
button_a = digitalio.DigitalInOut(board.BUTTON_A)
button_a.direction = digitalio.Direction.INPUT
button_a.pull = digitalio.Pull.DOWN

diff:
+import time
+
import analogio
import board
-import time
light = analogio.AnalogIn(board.LIGHT)
while True:
- print((light.value,))
+ print(light.value)
time.sleep(0.1)

diff:
import time
+
import analogio
import board
potentiometer = analogio.AnalogIn(board.A1)
+
def get_voltage(pin):
return (pin.value * 3.3) / 65536
+
while True:
print((get_voltage(potentiometer),))
time.sleep(0.1)

diff:
-import neopixel
-import analogio
import time
+
+import analogio
import board
+import neopixel
pixels = neopixel.NeoPixel(board.NEOPIXEL, 10, brightness=1.0)
light = analogio.AnalogIn(board.LIGHT)

diff:
import time
+
import board
import touchio

original_message: Format Sensor Plotting


message: Format Screaming Cauldron

diff:
# Screaming Cauldron
# for Adafruit Industries Learning Guide
-from digitalio import DigitalInOut, Direction
-from analogio import AnalogIn
-import neopixel
-import board
import time
+import board
+import neopixel
+from analogio import AnalogIn
+from digitalio import DigitalInOut, Direction
+
led = DigitalInOut(board.D13) # on board red LED
led.direction = Direction.OUTPUT
@@ -24,27 +25,30 @@ pixels = neopixel.NeoPixel(neoPin, numPix, auto_write=0, brightness=.8)
pixels.fill((0, 0, 0,))
pixels.show()
-def getVoltage(pin):
+
+def get_voltage(pin):
return (pin.value * 3.3) / 65536
-def remapRange(value, leftMin, leftMax, rightMin, rightMax):
+
+def remap_range(value, left_min, left_max, right_min, right_max):
# this remaps a value from original (left) range to new (right) range
# Figure out how 'wide' each range is
- leftSpan = leftMax - leftMin
- rightSpan = rightMax - rightMin
+ leftSpan = left_max - left_min
+ rightSpan = right_max - right_min
# Convert the left range into a 0-1 range (int)
- valueScaled = int(value - leftMin) / int(leftSpan)
+ valueScaled = int(value - left_min) / int(leftSpan)
# Convert the 0-1 range into a value in the right range.
- return int(rightMin + (valueScaled * rightSpan))
+ return int(right_min + (valueScaled * rightSpan))
+
while True:
distRaw = analog0in.value # read the raw sensor value
print("A0: %f" % distRaw) # write raw value to REPL
- distRedColor = remapRange(distRaw, 0, 64000, 0, 255)
- distGreenColor = remapRange(distRaw, 0, 64000, 200, 0)
- if(distRaw > 40000): # at about 4 inches, this goes off!
+ distRedColor = remap_range(distRaw, 0, 64000, 0, 255)
+ distGreenColor = remap_range(distRaw, 0, 64000, 200, 0)
+ if distRaw > 40000: # at about 4 inches, this goes off!
led.value = True
aFXPin.value = False
time.sleep(.35)

original_message: Format Screaming Cauldron


message: Format RGB LED Scripts

diff:
+import time
+
import board
import pulseio
-import time
RED_PIN = board.D5 # Red LED pin
GREEN_PIN = board.D6 # Green LED pin
@@ -14,10 +15,14 @@ red = pulseio.PWMOut(RED_PIN)
green = pulseio.PWMOut(GREEN_PIN)
blue = pulseio.PWMOut(BLUE_PIN)
+
# Function to simplify setting duty cycle to percent value.
+
+
def duty_cycle(percent):
return int(percent / 100.0 * 65535.0)
+
# Fade from nothing up to full red.
for i in range(100):
red.duty_cycle = duty_cycle(i)

original_message: Format RGB LED Scripts


message: Autoformat Microphone flag

diff:
@@ -40,7 +40,8 @@ sample_window = .1 # Sample window for average level
peak_hang = 24 # Time of pause before peak dot falls
peak_fall = 4 # Rate of falling peak dot
input_floor = 10 # Lower range of analogRead input
-input_ceiling = 300 # Max range of analogRead input, the lower the value the more sensitive (1023 = max)
+# Max range of analogRead input, the lower the value the more sensitive (1023 = max)
+input_ceiling = 300
peak = 16 # Peak level of column; used for falling dots
sample = 0
@@ -50,6 +51,7 @@ dothangcount = 0 # Frame counter for holding peak dot
strip = neopixel.NeoPixel(led_pin, n_pixels, brightness=1, auto_write=False)
+
def wheel(pos):
# Input a value 0 to 255 to get a color value.
# The colours are a transition r - g - b - back to r.
@@ -64,6 +66,7 @@ def wheel(pos):
pos -= 170
return (0, int(pos*3), int(255 - pos*3))
+
def remapRange(value, leftMin, leftMax, rightMin, rightMax):
# this remaps a value fromhere original (left) range to new (right) range
# Figure out how 'wide' each range is
@@ -76,6 +79,7 @@ def remapRange(value, leftMin, leftMax, rightMin, rightMax):
# Convert the 0-1 range into a value in the right range.
return int(rightMin + (valueScaled * rightSpan))
+
def fscale(originalmin, originalmax, newbegin, newend, inputvalue, curve):
originalrange = 0
newrange = 0
@@ -95,7 +99,8 @@ def fscale(originalmin, originalmax, newbegin, newend, inputvalue, curve):
# this seems more intuitive
# postive numbers give more weight to high end on output
curve = (curve * -.1)
- curve = pow(10, curve) # convert linear scale into lograthimic exponent for other pow function
+ # convert linear scale into lograthimic exponent for other pow function
+ curve = pow(10, curve)
# Check for out of range inputValues
if (inputvalue < originalmin):
@@ -125,10 +130,11 @@ def fscale(originalmin, originalmax, newbegin, newend, inputvalue, curve):
if (invflag == 0):
rangedvalue = (pow(normalizedcurval, curve) * newrange) + newbegin
else: # invert the ranges
- rangedvalue = newbegin - (pow(normalizedcurval, curve) * newrange);
+ rangedvalue = newbegin - (pow(normalizedcurval, curve) * newrange)
return(rangedvalue)
+
def drawLine(fromhere, to):
fromheretemp = 0
@@ -141,6 +147,7 @@ def drawLine(fromhere, to):
for i in range(fromhere, to):
strip[i] = (0, 0, 0)
+
while True:
time_start = time.monotonic() # current time used for sample window
@@ -153,7 +160,8 @@ while True:
# collect data for length of sample window (in seconds)
while ((time.monotonic() - time_start) < sample_window):
- sample = mic_pin.value / 64 # convert to arduino 10-bit [1024] fromhere 16-bit [65536]
+ # convert to arduino 10-bit [1024] fromhere 16-bit [65536]
+ sample = mic_pin.value / 64
if (sample < 1024): # toss out spurious readings

original_message: Autoformat Microphone flag


message: Autoformat 3D print Neopixel Gas Mask

diff:
@@ -41,7 +41,8 @@ while True: # Loop forever...
strip.write() # Refresh LED states
time.sleep(0.04) # 40 millisecond delay
offset += 1 # Shift animation by 1 pixel on next frame
- if offset >= 8: offset = 0
+ if offset >= 8:
+ offset = 0
# Additional animation modes could be added here!
t = time.monotonic() # Current time in seconds

original_message: Autoformat 3D print Neopixel Gas Mask


message: Autoformat 3D print NeoPixel Hair Dress

diff:
@@ -29,19 +29,22 @@ ACT_SPARKLING_RING = 0x20 # sparkling effect
numpix = 16 # total number of NeoPixels
pixel_output = board.D0 # pin where NeoPixels are connected
analog_input = board.A0 # needed to seed the random generator
-strip = neopixel.NeoPixel(pixel_output, numpix, brightness=.3, auto_write=False)
+strip = neopixel.NeoPixel(pixel_output, numpix,
+ brightness=.3, auto_write=False)
# available color generation methods
COL_RANDOM = 0x40 # colors will be generated randomly
COL_SPECTRUM = 0x80 # colors will be set as cyclic spectral wipe
# specifiyng the action list
-action_duration = 0 # the action's overall duration in milliseconds (be careful not
+# the action's overall duration in milliseconds (be careful not
+action_duration = 0
# to use values > 2^16-1 - roughly one minute :-)
action_and_color_gen = 1 # the color generation method
-action_step_duration = 2 # the duration of each action step rsp. the delay of the main
+# the duration of each action step rsp. the delay of the main
+action_step_duration = 2
# loop in milliseconds - thus, controls the action speed (be
# careful not to use values > 2^16-1 - roughly one minute :-)
@@ -50,7 +53,8 @@ color_granularity = 3 # controls the increment of the R, G, and B portions
# the increment is 0,10,20,... don't use values > 255, and note
# that even values > 127 wouldn't make much sense...
-color_interval = 4 # controls the speed of color changing independently from action
+# controls the speed of color changing independently from action
+color_interval = 4
# general global variables
color = 0
@@ -93,34 +97,60 @@ spectrum_part = 0
# duration color generation method duration granularity interval
theactionlist = [
[5, ACT_SPARKLING_RING | COL_RANDOM, 0.01, 25, 1],
- [ 2, ACT_CYCLING_RING_CLKW | COL_RANDOM, 0.02, 1, 0.005 ],
+ [2, ACT_CYCLING_RING_CLKW | COL_RANDOM,
+ 0.02, 1, 0.005],
[5, ACT_SPARKLING_RING | COL_RANDOM, 0.01, 25, 1],
- [ 2, ACT_CYCLING_RING_ACLK | COL_RANDOM, 0.02, 1, 0.005 ],
+ [2, ACT_CYCLING_RING_ACLK | COL_RANDOM,
+ 0.02, 1, 0.005],
[5, ACT_SPARKLING_RING | COL_RANDOM, 0.01, 25, 1],
- [ 2.5, ACT_CYCLING_RING_CLKW | COL_SPECTRUM, 0.25, 20, 0.020 ],
- [ 1, ACT_CYCLING_RING_CLKW | COL_SPECTRUM, 0.50, 1, 0.020 ],
- [ .750, ACT_CYCLING_RING_CLKW | COL_SPECTRUM, 0.075, 1, 0.020 ],
- [ .500, ACT_CYCLING_RING_CLKW | COL_SPECTRUM, 0.100, 1, 0.020 ],
- [ .500, ACT_CYCLING_RING_CLKW | COL_SPECTRUM, 0.125, 1, 0.020 ],
- [ .500, ACT_CYCLING_RING_CLKW | COL_SPECTRUM, 0.150, 1, 0.050 ],
- [ .500, ACT_CYCLING_RING_CLKW | COL_SPECTRUM, 0.175, 1, 0.100 ],
- [ .500, ACT_CYCLING_RING_CLKW | COL_SPECTRUM, 0.200, 1, 0.200 ],
- [ .750, ACT_CYCLING_RING_CLKW | COL_SPECTRUM, 0.225, 1, 0.250 ],
- [ 1, ACT_CYCLING_RING_CLKW | COL_SPECTRUM, 0.250, 1, 0.350 ],
- [ 30, ACT_SIMPLE_RING | COL_SPECTRUM, 0.050, 1, 0.010 ],
- [ 2.5, ACT_WHEEL_ACLK | COL_SPECTRUM, 0.010, 1, 0.010 ],
- [ 2.5, ACT_WHEEL_ACLK | COL_SPECTRUM, 0.015, 1, 0.020 ],
- [ 2, ACT_WHEEL_ACLK | COL_SPECTRUM, 0.025, 1, 0.030 ],
- [ 1, ACT_WHEEL_ACLK | COL_SPECTRUM, 0.050, 1, 0.040 ],
- [ 1, ACT_WHEEL_ACLK | COL_SPECTRUM, 0.075, 1, 0.040 ],
- [ 1, ACT_WHEEL_ACLK | COL_SPECTRUM, 0.100, 1, 0.050 ],
- [ .500, ACT_WHEEL_ACLK | COL_SPECTRUM, 0.125, 1, 0.060 ],
- [ .500, ACT_WHEEL_CLKW | COL_SPECTRUM, 0.125, 5, 0.050 ],
- [ 1, ACT_WHEEL_CLKW | COL_SPECTRUM, 0.100, 10, 0.040 ],
- [ 1.5, ACT_WHEEL_CLKW | COL_SPECTRUM, 0.075, 15, 0.030 ],
- [ 2, ACT_WHEEL_CLKW | COL_SPECTRUM, 0.050, 20, 0.020 ],
- [ 2.5, ACT_WHEEL_CLKW | COL_SPECTRUM, 0.025, 25, 0.010 ],
- [ 3, ACT_WHEEL_CLKW | COL_SPECTRUM, 0.010, 30, 0.005 ],
+ [2.5, ACT_CYCLING_RING_CLKW | COL_SPECTRUM,
+ 0.25, 20, 0.020],
+ [1, ACT_CYCLING_RING_CLKW | COL_SPECTRUM,
+ 0.50, 1, 0.020],
+ [.750, ACT_CYCLING_RING_CLKW | COL_SPECTRUM,
+ 0.075, 1, 0.020],
+ [.500, ACT_CYCLING_RING_CLKW | COL_SPECTRUM,
+ 0.100, 1, 0.020],
+ [.500, ACT_CYCLING_RING_CLKW | COL_SPECTRUM,
+ 0.125, 1, 0.020],
+ [.500, ACT_CYCLING_RING_CLKW | COL_SPECTRUM,
+ 0.150, 1, 0.050],
+ [.500, ACT_CYCLING_RING_CLKW | COL_SPECTRUM,
+ 0.175, 1, 0.100],
+ [.500, ACT_CYCLING_RING_CLKW | COL_SPECTRUM,
+ 0.200, 1, 0.200],
+ [.750, ACT_CYCLING_RING_CLKW | COL_SPECTRUM,
+ 0.225, 1, 0.250],
+ [1, ACT_CYCLING_RING_CLKW | COL_SPECTRUM,
+ 0.250, 1, 0.350],
+ [30, ACT_SIMPLE_RING | COL_SPECTRUM,
+ 0.050, 1, 0.010],
+ [2.5, ACT_WHEEL_ACLK | COL_SPECTRUM,
+ 0.010, 1, 0.010],
+ [2.5, ACT_WHEEL_ACLK | COL_SPECTRUM,
+ 0.015, 1, 0.020],
+ [2, ACT_WHEEL_ACLK | COL_SPECTRUM,
+ 0.025, 1, 0.030],
+ [1, ACT_WHEEL_ACLK | COL_SPECTRUM,
+ 0.050, 1, 0.040],
+ [1, ACT_WHEEL_ACLK | COL_SPECTRUM,
+ 0.075, 1, 0.040],
+ [1, ACT_WHEEL_ACLK | COL_SPECTRUM,
+ 0.100, 1, 0.050],
+ [.500, ACT_WHEEL_ACLK | COL_SPECTRUM,
+ 0.125, 1, 0.060],
+ [.500, ACT_WHEEL_CLKW | COL_SPECTRUM,
+ 0.125, 5, 0.050],
+ [1, ACT_WHEEL_CLKW | COL_SPECTRUM,
+ 0.100, 10, 0.040],
+ [1.5, ACT_WHEEL_CLKW | COL_SPECTRUM,
+ 0.075, 15, 0.030],
+ [2, ACT_WHEEL_CLKW | COL_SPECTRUM,
+ 0.050, 20, 0.020],
+ [2.5, ACT_WHEEL_CLKW | COL_SPECTRUM,
+ 0.025, 25, 0.010],
+ [3, ACT_WHEEL_CLKW | COL_SPECTRUM,
+ 0.010, 30, 0.005],
[5, ACT_SPARKLING_RING | COL_RANDOM, 0.010, 25, 1],
[5, ACT_NOP, 0, 0, 0]
]
@@ -153,6 +183,7 @@ def nextspectrumcolor():
spectrum_part = 1
color_idx = 0
+
def nextrandomcolor():
global color
@@ -170,6 +201,7 @@ def nextrandomcolor():
color = (random_red, random_green, random_blue)
+
def nextcolor():
# save some RAM for more animation actions
if (curr_color_gen & COL_RANDOM):
@@ -177,6 +209,7 @@ def nextcolor():
else:
nextspectrumcolor()
+
def setup():
# fingers corssed, the seeding makes sense to really get random colors...
@@ -188,6 +221,7 @@ def setup():
nextcolor()
strip.write()
+
setup()
while True: # Loop forever...

original_message: Autoformat 3D print NeoPixel Hair Dress


message: Autoformat Unicorn Horn

diff:
@@ -11,6 +11,7 @@ led.direction = Direction.OUTPUT
strip = neopixel.NeoPixel(pixpin, numpix, brightness=1, auto_write=True)
+
def wheel(pos):
# Input a value 0 to 255 to get a color value.
# The colours are a transition r - g - b - back to r.
@@ -25,6 +26,7 @@ def wheel(pos):
pos -= 170
return (0, int(pos*3), int(255 - pos*3))
+
def rainbow_cycle(wait):
for j in range(255*5):
for i in range(len(strip)):
@@ -32,11 +34,13 @@ def rainbow_cycle(wait):
strip[i] = wheel(idx & 255)
time.sleep(wait)
+
def rainbow(wait):
for j in range(255):
for i in range(len(strip)):
idx = int(i+j)
strip[i] = wheel(idx & 255)
+
while True:
rainbow_cycle(0.05)

original_message: Autoformat Unicorn Horn


message: Autformat the rest

diff:
-import board
import time
+
+import adafruit_motor.servo
+import board
import pulseio
-from digitalio import DigitalInOut, Direction, Pull
from analogio import AnalogIn
-import adafruit_motor.servo
+from digitalio import DigitalInOut, Direction, Pull
pwm = pulseio.PWMOut(board.D5, frequency=50)
servo = adafruit_motor.servo.Servo(pwm)

diff:
+import time
+
+import analogio
import board
import digitalio
-import analogio
import neopixel
-import time
+
try:
import urandom as random # for v1.0 API support
except:

diff:
import time
-from analogio import AnalogIn
+
+import adafruit_character_lcd
import adafruit_fancyled.adafruit_fancyled as fancy
import board
import digitalio
-import adafruit_character_lcd
import neopixel
+from analogio import AnalogIn
lcd_rs = digitalio.DigitalInOut(board.D5)
lcd_en = digitalio.DigitalInOut(board.D6)

diff:
-import time
import math
-from analogio import AnalogIn
+import time
+
+import adafruit_character_lcd
import board
import digitalio
-import adafruit_character_lcd
import neopixel
+from analogio import AnalogIn
lcd_rs = digitalio.DigitalInOut(board.D5)
lcd_en = digitalio.DigitalInOut(board.D6)

diff:
-from analogio import AnalogIn
-import board
import time
+
+import board
import neopixel
+from analogio import AnalogIn
pot = AnalogIn(board.A1) # what pin the pot is on
pixpin = board.D0 # what pin the LEDs are on

diff:
+import time
+
import board
import neopixel
-import time
pixpin = board.D1
numpix = 7

diff:
-from digitalio import DigitalInOut, Direction
+import time
+
import board
import neopixel
-import time
+from digitalio import DigitalInOut, Direction
pixpin = board.D1
numpix = 5
@@ -49,7 +50,6 @@ def rainbow(wait):
while True:
-
colorWipe((255, 0, 0), .1) # red and delay
colorWipe((0, 255, 0), .1) # green and delay
colorWipe((0, 0, 255), .1) # blue and delay

diff:
+import time
+
import board
import neopixel
-import time
+
try:
import urandom as random # for v1.0 API support
except ImportError:

diff:
+import time
+
import board
import neopixel
-import time
+
try:
import urandom as random
except ImportError:
@@ -17,7 +19,6 @@ colors = [
def flash_random(wait, howmany):
-
for k in range(howmany):
c = random.randint(0, len(colors) - 1) # Choose random color index

diff:
-from digitalio import DigitalInOut, Direction
import board
import busio
-import time
+from digitalio import DigitalInOut, Direction
+
try:
import struct
except ImportError:

original_message: Autformat the rest


message: Fix PEP8 compliance and fix remapRange

diff:
@@ -79,11 +79,14 @@ def wheel(pos):
def remapRange(value, leftMin, leftMax, rightMin, rightMax):
- # this remaps a value from original (left) range to new (right) range
+ # this remaps a value fromhere original (left) range to new (right) range
# Figure out how 'wide' each range is
leftSpan = leftMax - leftMin
rightSpan = rightMax - rightMin
+ # Convert the left range into a 0-1 range (int)
+ valueScaled = int(value - leftMin) / int(leftSpan)
+
# Convert the 0-1 range into a value in the right range.
return int(rightMin + (valueScaled * rightSpan))
@@ -96,13 +99,14 @@ def shortkeypress(color_palette):
return color_palette
+
while True:
# check for button press
currkeystate = button.value
# button press, move to next pattern
- if (prevkeystate != True) and currkeystate:
+ if (prevkeystate is not True) and currkeystate:
ledmode = shortkeypress(ledmode)
# save button press state

original_message: Fix PEP8 compliance and fix remapRange


message: Fix duplicate variable name

diff:
@@ -58,16 +58,16 @@ statusled.direction = Direction.OUTPUT
print("Waiting for button presses")
-def pressbutton(i):
- switch_led = leds[i] # find the switch LED
- k = buttonkeys[i] # get the corresp. keycode/str
+def pressbutton(index):
+ switch_led = leds[index] # find the switch LED
+ k = buttonkeys[index] # get the corresp. keycode/str
switch_led.value = True # turn on LED
kbd.press(k) # send keycode
-def releasebutton(i):
- switch_led = leds[i] # find the switch LED
- k = buttonkeys[i] # get the corresp. keycode/str
+def releasebutton(index):
+ switch_led = leds[index] # find the switch LED
+ k = buttonkeys[index] # get the corresp. keycode/str
switch_led.value = False # turn on LED
kbd.release(k) # send keycode

original_message: Fix duplicate variable name


message: Rename variables that have builtin names

diff:
@@ -120,11 +120,13 @@ def int_to_bytestring(i, padding=8):
# https://github.com/pyotp/pyotp/blob/master/src/pyotp/otp.py
-def generate_otp(input, secret, digits=6):
- if input < 0:
+def generate_otp(int_input, secret_key, digits=6):
+ if int_input < 0:
raise ValueError('input must be positive integer')
hmac_hash = bytearray(
- HMAC(bytes(base32_decode(secret)), int_to_bytestring(input)).digest())
+ HMAC(bytes(base32_decode(secret_key)),
+ int_to_bytestring(int_input)).digest()
+ )
offset = hmac_hash[-1] & 0xf
code = ((hmac_hash[offset] & 0x7f) << 24 |
(hmac_hash[offset + 1] & 0xff) << 16 |


message: Rename unused variable

diff:
@@ -34,7 +34,7 @@ ringtone_tempo = 1.6 # suggested Nokia 0.9 , iPhone 1.3 , Rickroll 2.0
def annoy_beep(frequency, length, repeat, rest, interval):
- for r in range(repeat):
+ for _ in range(repeat):
piezo.frequency = frequency # 2600 is a nice choice
piezo.duty_cycle = 65536 // 2 # on 50%
time.sleep(length) # sound on
@@ -211,8 +211,8 @@ def annoy_ringtone(ringtone, tempo, interval):
def annoy_crickets(repeat, interval):
- for i in range(repeat):
- for r in range(6):
+ for _ in range(repeat):
+ for _ in range(6):
piezo.frequency = 8000 # 2600 is a nice choice
piezo.duty_cycle = 65536 // 2 # on 50%
time.sleep(0.02) # sound on
@@ -231,17 +231,17 @@ def annoy_teen_tone(interval):
while True:
- if annoy_mode is 1:
+ if annoy_mode == 1:
annoy_beep(frequency, length, repeat, rest, interval)
- elif annoy_mode is 2:
+ elif annoy_mode == 2:
annoy_doorbell(interval)
- elif annoy_mode is 3:
+ elif annoy_mode == 3:
annoy_ringtone(ringtone, ringtone_tempo, interval)
- elif annoy_mode is 4:
+ elif annoy_mode == 4:
annoy_crickets(repeat, interval)
- elif annoy_mode is 5:
+ elif annoy_mode == 5:
annoy_teen_tone(interval)
- elif annoy_mode is 6:
+ elif annoy_mode == 6:
annoy_beep(5000, 0.2, 2, 0.05, 3)
annoy_doorbell(3)
annoy_ringtone(1, 0.9, 3)

original_message: Rename unused variable


message: Add unused-variable to pylint disable

old_path: .pylintrc

new_path: .pylintrc

original_message: Add unused-variable to pylint disable


message: Update disable and move message format to new line


message: Move comments into functions

diff:
@@ -26,10 +26,8 @@ temp = ccs.temperature
ccs.temp_offset = temp - 25.0
-# clear all LEDs for breathing effect
-
-
def clear_pix(delay):
+ # clear all LEDs for breathing effect
for i in range(0, num_leds):
temperature_pix[i] = (0, 0, 0)
co2_pix[i] = (0, 0, 0, 0)
@@ -37,10 +35,8 @@ def clear_pix(delay):
time.sleep(delay)
-# Show Carbon Dioxide on a NeoPixel Strip
-
-
def co2_led_meter():
+ # Show Carbon Dioxide on a NeoPixel Strip
co2_floor = 400
co2_ceiling = 8192
@@ -55,10 +51,8 @@ def co2_led_meter():
time.sleep(led_draw)
-# Show Total Volatile Organic Compounds on a NeoPixel Strip
-
-
def tvoc_led_meter():
+ # Show Total Volatile Organic Compounds on a NeoPixel Strip
tvoc_floor = 0
tvoc_ceiling = 1187
@@ -73,10 +67,8 @@ def tvoc_led_meter():
time.sleep(led_draw)
-# Show Temperature on Circuit Playground built-in NeoPixels
-
-
def temp_led_meter():
+ # Show Temperature on Circuit Playground built-in NeoPixels
temp_floor = 23
temp_ceiling = 36

original_message: Move comments into functions


message: added MIDI Solenoid Drummer code

diff:
+/* MIDI Solenoid Drummer
+ for use with Adafruit Feather + Crickit Featherwing
+ assumes a 5V solenoid connected to each of Crickit's four Drive ports
+*/
+
+#include "Adafruit_Crickit.h"
+#include "MIDIUSB.h"
+
+Adafruit_Crickit crickit;
+
+#define NUM_DRIVES 4
+int drives[] = {CRICKIT_DRIVE1, CRICKIT_DRIVE2, CRICKIT_DRIVE3, CRICKIT_DRIVE4};
+int cym = CRICKIT_DRIVE4;
+int kick = CRICKIT_DRIVE3;
+int snare = CRICKIT_DRIVE2;
+int shake = CRICKIT_DRIVE1;
+int hitDur = 8; //solenoid on duration for each hit (in milliseconds)
+
+int cymLED = CRICKIT_SIGNAL4;
+int kickLED = CRICKIT_SIGNAL3;
+int snareLED = CRICKIT_SIGNAL2;
+int shakeLED = CRICKIT_SIGNAL1;
+
+void setup() {
+
+ if (!crickit.begin()) {
+ while (1);
+ }
+
+ for (int i = 0; i < NUM_DRIVES; i++)
+ crickit.setPWMFreq(drives[i], 1000); //default frequency is 1khz
+
+ crickit.pinMode(cymLED, OUTPUT);
+
+ crickit.digitalWrite(cymLED, HIGH);
+ delay(5000);
+ crickit.digitalWrite(cymLED, LOW);
+
+ test(); //test solenoids at start
+}
+
+void loop() {
+
+ midiEventPacket_t rx = MidiUSB.read();
+
+ switch (rx.header) {
+ case 0x9:
+ handleNoteOn(
+ rx.byte1 & 0xF, //channel
+ rx.byte2, //pitch
+ rx.byte3 //velocity
+ );
+ break;
+ default:
+ break;
+ }
+}
+
+void handleNoteOn(byte channel, byte pitch, byte velocity) {
+
+ switch (pitch) {
+ case 24: //kick = C1/24
+ hit(kick, hitDur);
+ break;
+ case 28: //snare = E1/28
+ hit(snare, hitDur);
+ break;
+ case 36: //shake = C2/36
+ hit(shake, hitDur);
+ break;
+ case 37: //cymbal = C#2/37
+ hit(cym, hitDur);
+ break;
+ default:
+ break;
+ }
+}
+
+void hit(int drum, int dur) {
+
+ crickit.analogWrite(drum, CRICKIT_DUTY_CYCLE_MAX); //turn all the way on
+ crickit.digitalWrite(cymLED, HIGH);
+ delay(dur); // wait
+ crickit.analogWrite(drum, CRICKIT_DUTY_CYCLE_OFF); //turn all the way off
+ crickit.digitalWrite(cymLED, LOW);
+}
+
+void test() { //for debugging
+ hit(cym, hitDur);
+ delay(400);
+ hit(kick, hitDur);
+ delay(400);
+ hit(snare, hitDur);
+ delay(400);
+ hit(shake, hitDur);
+ delay(400);
+}
+

original_message: added MIDI Solenoid Drummer code


message: File naming, misc fixes

change_type: RENAME

diff:
/* MIDI Solenoid Drummer
- for use with Adafruit Feather + Crickit Featherwing
- assumes a 5V solenoid connected to each of Crickit's four Drive ports
+ * for use with Adafruit Feather + Crickit Featherwing
+ * assumes a 5V solenoid connected to each of Crickit's four Drive ports
*/
#include "Adafruit_Crickit.h"
@@ -16,11 +16,6 @@ int snare = CRICKIT_DRIVE2;
int shake = CRICKIT_DRIVE1;
int hitDur = 8; //solenoid on duration for each hit (in milliseconds)
-int cymLED = CRICKIT_SIGNAL4;
-int kickLED = CRICKIT_SIGNAL3;
-int snareLED = CRICKIT_SIGNAL2;
-int shakeLED = CRICKIT_SIGNAL1;
-
void setup() {
if (!crickit.begin()) {
@@ -30,12 +25,6 @@ void setup() {
for (int i = 0; i < NUM_DRIVES; i++)
crickit.setPWMFreq(drives[i], 1000); //default frequency is 1khz
- crickit.pinMode(cymLED, OUTPUT);
-
- crickit.digitalWrite(cymLED, HIGH);
- delay(5000);
- crickit.digitalWrite(cymLED, LOW);
-
test(); //test solenoids at start
}
@@ -60,39 +49,35 @@ void handleNoteOn(byte channel, byte pitch, byte velocity) {
switch (pitch) {
case 24: //kick = C1/24
- hit(kick, hitDur);
+ hit(kick);
break;
- case 28: //snare = E1/28
- hit(snare, hitDur);
+ case 25: //snare = C#1/25
+ hit(snare);
break;
- case 36: //shake = C2/36
- hit(shake, hitDur);
+ case 26: //shake = D1/26
+ hit(shake);
break;
- case 37: //cymbal = C#2/37
- hit(cym, hitDur);
+ case 27: //cymbal = D#1/27
+ hit(cym);
break;
default:
break;
}
}
-void hit(int drum, int dur) {
-
+void hit(int drum) {
crickit.analogWrite(drum, CRICKIT_DUTY_CYCLE_MAX); //turn all the way on
- crickit.digitalWrite(cymLED, HIGH);
- delay(dur); // wait
+ delay(hitDur); // wait
crickit.analogWrite(drum, CRICKIT_DUTY_CYCLE_OFF); //turn all the way off
- crickit.digitalWrite(cymLED, LOW);
}
void test() { //for debugging
- hit(cym, hitDur);
+ hit(cym);
delay(400);
- hit(kick, hitDur);
+ hit(kick);
delay(400);
- hit(snare, hitDur);
+ hit(snare);
delay(400);
- hit(shake, hitDur);
+ hit(shake);
delay(400);
}
-

original_message: File naming, misc fixes


message: Create Neotrellis_M4_Live_Launcher.ino

diff:
+/* Live Launcher - Ableton Live controller for Adafruit Neotrellis M4
+ by Collin Cunningham for Adafruit Industries
+ https://www.adafruit.com/product/3938
+*/
+
+#include <Adafruit_NeoTrellisM4.h>
+
+#define WIDTH 8
+#define HEIGHT 4
+#define N_BUTTONS WIDTH*HEIGHT
+#define NEO_PIN 10
+#define NUM_KEYS 32
+#define SERIAL_TIMEOUT 1000 //time before giving up on incoming serial data
+#define COLOR_DATA_LENGTH 98 //number of total bytes to expect in incoming color data
+//4 bytes per color * 32 buttons = 128 bytes + 2 header bytes = 130 bytes total
+#define BUTTON_DATA_LENGTH 5 //clip playing status message for each button
+#define PULSE_DURATION 350 //length of 'now playing' pulse
+
+unsigned long readTime; //time we start reading serial buffer
+unsigned long lastPulseTime;
+bool pulseOn = false;
+uint8_t packetbuffer[COLOR_DATA_LENGTH]; //store incoming serial data
+uint8_t colors[96];
+
+Adafruit_NeoTrellisM4 trellis = Adafruit_NeoTrellisM4();
+
+const byte ROWS = HEIGHT; // four rows
+const byte COLS = WIDTH; // eight columns
+byte trellisKeys[ROWS][COLS] = { //define the symbols on the buttons of the keypads
+ {1, 2, 3, 4, 5, 6, 7, 8},
+ {9, 10, 11, 12, 13, 14, 15, 16},
+ {17, 18, 19, 20, 21, 22, 23, 24},
+ {25, 26, 27, 28, 29, 30, 31, 32}
+};
+byte rowPins[ROWS] = {14, 15, 16, 17}; //connect to the row pinouts of the keypad
+byte colPins[COLS] = {2, 3, 4, 5, 6, 7, 8, 9}; //connect to the column pinouts of the keypad
+Adafruit_Keypad customKeypad = Adafruit_Keypad( makeKeymap(trellisKeys), rowPins, colPins, ROWS, COLS); //initialize keypad
+extern const uint8_t gamma8[];
+
+boolean pressed[N_BUTTONS] = {false}; // Pressed state for each button
+uint8_t playing[N_BUTTONS] = {0}; // Playing state for each button
+
+void setup() {
+ Serial.begin(57600);
+ // while (!Serial) {}
+
+ trellis.begin();
+ trellis.setBrightness(255);
+ trellis.fill(0);
+}
+
+
+void loop() {
+ unsigned long startTime = millis();
+
+ if (Serial.available() >= BUTTON_DATA_LENGTH) {
+ parseData();
+ }
+
+ //send press events to Live via serial
+ trellis.tick();
+ while (trellis.available()) {
+ keypadEvent e = trellis.read();
+ uint8_t i = e.bit.KEY;
+ if (e.bit.EVENT == KEY_JUST_PRESSED) {
+ pressed[i] = true;
+ Serial.write(i);
+ }
+ else if (e.bit.EVENT == KEY_JUST_RELEASED) {
+ pressed[i] = false;
+ }
+ }
+
+ if ((startTime - lastPulseTime) >= PULSE_DURATION) {
+
+ //flash any clip which is playing
+ if (pulseOn) {
+ for (uint8_t i = 0; i < N_BUTTONS; i++) {
+ setPixelWithColorsIndex(i, false);
+ }
+ }
+ else {
+ for (uint8_t i = 0; i < N_BUTTONS; i++) {
+ if (playing[i]) {
+ setPixelWithColorsIndex(i, true);
+ }
+ else setPixelWithColorsIndex(i, false);
+ }
+ }
+ pulseOn = !pulseOn;
+ lastPulseTime = millis();
+ }
+}
+
+void parseData() {
+
+ //check for ! start char
+ if (Serial.read() == '!') {
+ uint8_t id = Serial.read();
+
+ //check for Color data
+ if (id == 'C') {
+ for (int i = 0; i < 96; i++) {
+ colors[i] = Serial.read();
+ }
+
+ //color button leds
+ for (int i = 0; i < N_BUTTONS; i++) {
+ setPixelWithColorsIndex(i, false);
+ }
+ }
+
+ //check for clip status data
+ else if (id == 'B') {
+ uint8_t x = Serial.read();
+ uint8_t state = Serial.read();
+ uint8_t y = Serial.read();
+
+ if (state == 0) { //if state is 0, all clips in track are stopped
+ for (int i = 0; i < HEIGHT; i++) {
+ uint8_t index = i * WIDTH + x;
+ playing[index] = state;
+ }
+ }
+
+ else { //all other clips in track should stop
+ for (int i = 0; i < HEIGHT; i++) {
+ uint8_t index = i * WIDTH + x;
+ playing[index] = 0;
+ }
+ //save playing state
+ uint8_t index = y * WIDTH + x;
+ playing[index] = state;
+ }
+ }
+ }
+}
+
+void setPixelWithColorsIndex(int i, bool dimmed) {
+
+ uint8_t red = colors[i * 3];
+ uint8_t green = colors[i * 3 + 1];
+ uint8_t blue = colors[i * 3 + 2];
+ if (dimmed) {
+ setPixelWithGamma(i, red / 2, green / 2, blue / 2);
+ }
+ else {
+ setPixelWithGamma(i, red, green, blue);
+ }
+
+}
+
+void setPixelWithGamma(int pixelNumber, uint8_t red, uint8_t green, uint8_t blue) {
+
+ uint32_t color = trellis.Color(
+ pgm_read_byte(&gamma8[red]),
+ pgm_read_byte(&gamma8[green]),
+ pgm_read_byte(&gamma8[blue]));
+
+ trellis.setPixelColor(pixelNumber, color);
+}
+
+const uint8_t PROGMEM gamma8[] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
+ 2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5,
+ 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10,
+ 10, 10, 11, 11, 11, 12, 12, 13, 13, 13, 14, 14, 15, 15, 16, 16,
+ 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 24, 24, 25,
+ 25, 26, 27, 27, 28, 29, 29, 30, 31, 32, 32, 33, 34, 35, 35, 36,
+ 37, 38, 39, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 50,
+ 51, 52, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68,
+ 69, 70, 72, 73, 74, 75, 77, 78, 79, 81, 82, 83, 85, 86, 87, 89,
+ 90, 92, 93, 95, 96, 98, 99, 101, 102, 104, 105, 107, 109, 110, 112, 114,
+ 115, 117, 119, 120, 122, 124, 126, 127, 129, 131, 133, 135, 137, 138, 140, 142,
+ 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 167, 169, 171, 173, 175,
+ 177, 180, 182, 184, 186, 189, 191, 193, 196, 198, 200, 203, 205, 208, 210, 213,
+ 215, 218, 220, 223, 225, 228, 231, 233, 236, 239, 241, 244, 247, 249, 252, 255
+};
+

original_message: Create Neotrellis_M4_Live_Launcher.ino


message:
add travis-ci-arduino
Depends on

diff:
@@ -4,11 +4,39 @@ language: python
python:
- "3.6"
+cache:
+
cache:
pip: true
+ directories:
+ - ~/arduino_ide
+ - ~/.arduino15/packages/
+
+env:
+ global:
+ - ARDUINO_IDE_VERSION="1.8.7"
+ - PRETTYNAME="Adafruit Learning System Guides"
+ - PLATFORM_CHECK_ONLY_ON_FILE=true
+
+before_install:
+ - source ./travis-ci-arduino-install
install:
+ - arduino --install-library "Adafruit ILI9341"
+ - arduino --install-library "Adafruit GFX Library"
+ - arduino --install-library "FastLED"
+ - arduino --install-library "Adafruit NeoTrellis M4 Library"
+ - arduino --install-library "Adafruit Keypad"
+ - arduino --install-library "Adafruit NeoPixel"
+ - arduino --install-library "Adafruit DMA neopixel library"
+ - arduino --install-library "Adafruit NeoMatrix"
+ - arduino --install-library "Adafruit Zero DMA Library"
+ - arduino --install-library "MIDIUSB"
- pip install --force-reinstall pylint==1.9.2
script:
- ./pylint_check
+ - build_main_platforms
+ - build_cplay_platforms
+ - build_m4_platforms
+ - build_io_platforms

original_message:
add travis-ci-arduino

Depends on https://github.com/adafruit/travis-ci-arduino/pull/36


message:
remotely source travis-ci-arduino/install.sh
Uses the one on the branch for now.

diff:
@@ -19,7 +19,7 @@ env:
- PLATFORM_CHECK_ONLY_ON_FILE=true
before_install:
- - source ./travis-ci-arduino-install
+ - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/platform_check_only_if_file/install.sh)
install:
- arduino --install-library "Adafruit ILI9341"


message: add build_aux_platforms call; test bionic eye with trinket

diff:
@@ -32,11 +32,13 @@ install:
- arduino --install-library "Adafruit NeoMatrix"
- arduino --install-library "Adafruit Zero DMA Library"
- arduino --install-library "MIDIUSB"
+ - arduino --install-library "Adafruit SoftServo"
- pip install --force-reinstall pylint==1.9.2
script:
- ./pylint_check
- build_main_platforms
+ - build_aux_platforms
- build_cplay_platforms
- build_m4_platforms
- build_io_platforms


message: travis-ci: test a bunch of 3D_Printed_*/ examples

diff:
@@ -33,6 +33,7 @@ install:
- arduino --install-library "Adafruit Zero DMA Library"
- arduino --install-library "MIDIUSB"
- arduino --install-library "Adafruit SoftServo"
+ - arduino --install-library "TinyWireM"
- pip install --force-reinstall pylint==1.9.2
script:


message: travis-ci: pull arduino library install into a separate script

diff:
@@ -11,6 +11,7 @@ cache:
directories:
- ~/arduino_ide
- ~/.arduino15/packages/
+ - ~/Arduino
env:
global:
@@ -22,18 +23,7 @@ before_install:
- source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/platform_check_only_if_file/install.sh)
install:
- - arduino --install-library "Adafruit ILI9341"
- - arduino --install-library "Adafruit GFX Library"
- - arduino --install-library "FastLED"
- - arduino --install-library "Adafruit NeoTrellis M4 Library"
- - arduino --install-library "Adafruit Keypad"
- - arduino --install-library "Adafruit NeoPixel"
- - arduino --install-library "Adafruit DMA neopixel library"
- - arduino --install-library "Adafruit NeoMatrix"
- - arduino --install-library "Adafruit Zero DMA Library"
- - arduino --install-library "MIDIUSB"
- - arduino --install-library "Adafruit SoftServo"
- - arduino --install-library "TinyWireM"
+ - ./arduino_library_install
- pip install --force-reinstall pylint==1.9.2
script:

diff:
+#!/bin/bash
+
+[ ! -d $HOME/Arduino/libraries/Adafruit_ILI9341 ] && arduino --install-library "Adafruit ILI9341"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_GFX_Library ] && arduino --install-library "Adafruit GFX Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/FastLED ] && arduino --install-library "FastLED"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_NeoTrellis_M4_Library ] && arduino --install-library "Adafruit NeoTrellis M4 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_Keypad ] && arduino --install-library "Adafruit Keypad"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_NeoPixel ] && arduino --install-library "Adafruit NeoPixel"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_DMA_neopixel_library ] && arduino --install-library "Adafruit DMA neopixel library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_NeoMatrix ] && arduino --install-library "Adafruit NeoMatrix"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_Zero_DMA_Library ] && arduino --install-library "Adafruit Zero DMA Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/MIDIUSB ] && arduino --install-library "MIDIUSB"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_SoftServo ] && arduino --install-library "Adafruit SoftServo"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/TinyWireM ] && arduino --install-library "TinyWireM"


message: travis-ci: AM_Radio_Morse - Chirping_Plush_Owl .*.test files

diff:
-/ Mindfulness Bracelet sketch for Adafruit/Arduino Gemma. Briefly runs
+// Mindfulness Bracelet sketch for Adafruit/Arduino Gemma. Briefly runs
// vibrating motor (connected through transistor) at regular intervals.
// This code is not beginner-friendly, it does a lot of esoteric low-level
// hardware shenanigans in order to conserve battery power.

diff:
@@ -23,3 +23,7 @@ sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_SoftServo ] && arduino --install-library "Adafruit SoftServo"
sleep 1
[ ! -d $HOME/Arduino/libraries/TinyWireM ] && arduino --install-library "TinyWireM"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_BluefruitLE_nRF51 ] && arduino --install-library "Adafruit BluefruitLE nRF51"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_AM_radio_library ] && arduino --install-library "Adafruit AM radio library"


message: add generated library list

diff:
#!/bin/bash
-[ ! -d $HOME/Arduino/libraries/Adafruit_ILI9341 ] && arduino --install-library "Adafruit ILI9341"
+[ ! -d $HOME/Arduino/libraries/FastLED ] && arduino --install-library "FastLED"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/MIDIUSB ] && arduino --install-library "MIDIUSB"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/TinyWireM ] && arduino --install-library "TinyWireM"
+sleep 1
+
+# These are generated:
+[ ! -d $HOME/Arduino/libraries/Adafruit_ADS1X15 ] && arduino --install-library "Adafruit ADS1X15"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_ADXL345 ] && arduino --install-library "Adafruit ADXL345"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_AHRS ] && arduino --install-library "Adafruit AHRS"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_AM2315 ] && arduino --install-library "Adafruit AM2315"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_AM2320_sensor_library ] && arduino --install-library "Adafruit AM2320 sensor library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_AMG88xx_Library ] && arduino --install-library "Adafruit AMG88xx Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_AM_radio_library ] && arduino --install-library "Adafruit AM radio library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_APDS9960_Library ] && arduino --install-library "Adafruit APDS9960 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_BLEFirmata ] && arduino --install-library "Adafruit BLEFirmata"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_BluefruitLE_nRF51 ] && arduino --install-library "Adafruit BluefruitLE nRF51"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_BME280_Library ] && arduino --install-library "Adafruit BME280 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_BME680_Library ] && arduino --install-library "Adafruit BME680 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_BMP085_Library ] && arduino --install-library "Adafruit BMP085 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_BMP085_Unified ] && arduino --install-library "Adafruit BMP085 Unified"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_BMP183_Library ] && arduino --install-library "Adafruit BMP183 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_BMP183_Unified_Library ] && arduino --install-library "Adafruit BMP183 Unified Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_BMP280_Library ] && arduino --install-library "Adafruit BMP280 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_BMP3XX_Library ] && arduino --install-library "Adafruit BMP3XX Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_BNO055 ] && arduino --install-library "Adafruit BNO055"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_CAP1188_Library ] && arduino --install-library "Adafruit CAP1188 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_CC3000_Library ] && arduino --install-library "Adafruit CC3000 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_CCS811_Library ] && arduino --install-library "Adafruit CCS811 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_Circuit_Playground ] && arduino --install-library "Adafruit Circuit Playground"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_composite_video_Library ] && arduino --install-library "Adafruit composite video Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_DAP_library ] && arduino --install-library "Adafruit DAP library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_DMA_neopixel_library ] && arduino --install-library "Adafruit DMA neopixel library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_DotStar ] && arduino --install-library "Adafruit DotStar"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_DRV2605_Library ] && arduino --install-library "Adafruit DRV2605 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_EPD ] && arduino --install-library "Adafruit EPD"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_ESP8266 ] && arduino --install-library "Adafruit ESP8266"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_Fingerprint_Sensor_Library ] && arduino --install-library "Adafruit Fingerprint Sensor Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_Flora_Pixel_Library ] && arduino --install-library "Adafruit Flora Pixel Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_FONA_Library ] && arduino --install-library "Adafruit FONA Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_FRAM_I2C ] && arduino --install-library "Adafruit FRAM I2C"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_FRAM_SPI ] && arduino --install-library "Adafruit FRAM SPI"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_FreeTouch_Library ] && arduino --install-library "Adafruit FreeTouch Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_FT6206_Library ] && arduino --install-library "Adafruit FT6206 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_FXAS21002C ] && arduino --install-library "Adafruit FXAS21002C"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_FXOS8700 ] && arduino --install-library "Adafruit FXOS8700"
sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_GFX_Library ] && arduino --install-library "Adafruit GFX Library"
sleep 1
-[ ! -d $HOME/Arduino/libraries/FastLED ] && arduino --install-library "FastLED"
+[ ! -d $HOME/Arduino/libraries/Adafruit_GPS_Library ] && arduino --install-library "Adafruit GPS Library"
sleep 1
-[ ! -d $HOME/Arduino/libraries/Adafruit_NeoTrellis_M4_Library ] && arduino --install-library "Adafruit NeoTrellis M4 Library"
+[ ! -d $HOME/Arduino/libraries/Adafruit_Graphic_VFD_Display_Library ] && arduino --install-library "Adafruit Graphic VFD Display Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_HDC1000_Library ] && arduino --install-library "Adafruit HDC1000 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_HMC5883_Unified ] && arduino --install-library "Adafruit HMC5883 Unified"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_HTU21DF_Library ] && arduino --install-library "Adafruit HTU21DF Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_HX8340B ] && arduino --install-library "Adafruit HX8340B"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_HX8357_Library ] && arduino --install-library "Adafruit HX8357 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_ILI9341 ] && arduino --install-library "Adafruit ILI9341"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_ImageReader_Library ] && arduino --install-library "Adafruit ImageReader Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_INA219 ] && arduino --install-library "Adafruit INA219"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_IO_Arduino ] && arduino --install-library "Adafruit IO Arduino"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_IS31FL3731_Library ] && arduino --install-library "Adafruit IS31FL3731 Library"
sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_Keypad ] && arduino --install-library "Adafruit Keypad"
sleep 1
-[ ! -d $HOME/Arduino/libraries/Adafruit_NeoPixel ] && arduino --install-library "Adafruit NeoPixel"
+[ ! -d $HOME/Arduino/libraries/Adafruit_L3GD20_U ] && arduino --install-library "Adafruit L3GD20 U"
sleep 1
-[ ! -d $HOME/Arduino/libraries/Adafruit_DMA_neopixel_library ] && arduino --install-library "Adafruit DMA neopixel library"
+[ ! -d $HOME/Arduino/libraries/Adafruit_LED_Backpack_Library ] && arduino --install-library "Adafruit LED Backpack Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_LiquidCrystal ] && arduino --install-library "Adafruit LiquidCrystal"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_LIS3DH ] && arduino --install-library "Adafruit LIS3DH"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_LSM303DLHC ] && arduino --install-library "Adafruit LSM303DLHC"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_LSM9DS0_Library ] && arduino --install-library "Adafruit LSM9DS0 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_LSM9DS1_Library ] && arduino --install-library "Adafruit LSM9DS1 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_MAX31855_library ] && arduino --install-library "Adafruit MAX31855 library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_MAX31856_library ] && arduino --install-library "Adafruit MAX31856 library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_MAX31865_library ] && arduino --install-library "Adafruit MAX31865 library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_MCP23008_library ] && arduino --install-library "Adafruit MCP23008 library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_MCP23017_Arduino_Library ] && arduino --install-library "Adafruit MCP23017 Arduino Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_MCP3008 ] && arduino --install-library "Adafruit MCP3008"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_MCP4725 ] && arduino --install-library "Adafruit MCP4725"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_MCP9808_Library ] && arduino --install-library "Adafruit MCP9808 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_MFRC630_RFID ] && arduino --install-library "Adafruit MFRC630 RFID"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_microbit_Library ] && arduino --install-library "Adafruit microbit Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_MiniMLX90614 ] && arduino --install-library "Adafruit MiniMLX90614"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_MLX90614_Library ] && arduino --install-library "Adafruit MLX90614 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_MMA8451_Library ] && arduino --install-library "Adafruit MMA8451 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_Motor_Shield_library ] && arduino --install-library "Adafruit Motor Shield library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_Motor_Shield_V2_Library ] && arduino --install-library "Adafruit Motor Shield V2 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_mp3 ] && arduino --install-library "Adafruit_mp3"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_MPL115A2 ] && arduino --install-library "Adafruit MPL115A2"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_MPL3115A2_Library ] && arduino --install-library "Adafruit MPL3115A2 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_MPR121 ] && arduino --install-library "Adafruit MPR121"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_MPRLS_Library ] && arduino --install-library "Adafruit MPRLS Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_MQTT_Library ] && arduino --install-library "Adafruit MQTT Library"
sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_NeoMatrix ] && arduino --install-library "Adafruit NeoMatrix"
sleep 1
-[ ! -d $HOME/Arduino/libraries/Adafruit_Zero_DMA_Library ] && arduino --install-library "Adafruit Zero DMA Library"
+[ ! -d $HOME/Arduino/libraries/Adafruit_NeoMatrix_ZeroDMA_library ] && arduino --install-library "Adafruit NeoMatrix ZeroDMA library"
sleep 1
-[ ! -d $HOME/Arduino/libraries/MIDIUSB ] && arduino --install-library "MIDIUSB"
+[ ! -d $HOME/Arduino/libraries/Adafruit_NeoPixel ] && arduino --install-library "Adafruit NeoPixel"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_NeoPXL8 ] && arduino --install-library "Adafruit NeoPXL8"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_NeoTrellis_M4_Library ] && arduino --install-library "Adafruit NeoTrellis M4 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_nRF8001 ] && arduino --install-library "Adafruit nRF8001"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_PCD8544_Nokia_5110_LCD_library ] && arduino --install-library "Adafruit PCD8544 Nokia 5110 LCD library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_PN532 ] && arduino --install-library "Adafruit PN532"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_PS2_Trackpad ] && arduino --install-library "Adafruit PS2 Trackpad"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_PWM_Servo_Driver_Library ] && arduino --install-library "Adafruit PWM Servo Driver Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_QSPI ] && arduino --install-library "Adafruit QSPI"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_RA8875 ] && arduino --install-library "Adafruit RA8875"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_RGB_LCD_Shield_Library ] && arduino --install-library "Adafruit RGB LCD Shield Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_seesaw_Library ] && arduino --install-library "Adafruit seesaw Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_SGP30_Sensor ] && arduino --install-library "Adafruit SGP30 Sensor"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_SHARP_Memory_Display ] && arduino --install-library "Adafruit SHARP Memory Display"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_SHT31_Library ] && arduino --install-library "Adafruit SHT31 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_SI1145_Library ] && arduino --install-library "Adafruit SI1145 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_Si4713_Library ] && arduino --install-library "Adafruit Si4713 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_Si5351_Library ] && arduino --install-library "Adafruit Si5351 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_Si7021_Library ] && arduino --install-library "Adafruit Si7021 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_SleepyDog_Library ] && arduino --install-library "Adafruit SleepyDog Library"
sleep 1
[ ! -d $HOME/Arduino/libraries/Adafruit_SoftServo ] && arduino --install-library "Adafruit SoftServo"
sleep 1
-[ ! -d $HOME/Arduino/libraries/TinyWireM ] && arduino --install-library "TinyWireM"
+[ ! -d $HOME/Arduino/libraries/Adafruit_Soundboard_library ] && arduino --install-library "Adafruit Soundboard library"
sleep 1
-[ ! -d $HOME/Arduino/libraries/Adafruit_BluefruitLE_nRF51 ] && arduino --install-library "Adafruit BluefruitLE nRF51"
+[ ! -d $HOME/Arduino/libraries/Adafruit_SPIFlash ] && arduino --install-library "Adafruit SPIFlash"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_SSD1306 ] && arduino --install-library "Adafruit SSD1306"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_SSD1306_Wemos_Mini_OLED ] && arduino --install-library "Adafruit SSD1306 Wemos Mini OLED"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_SSD1325 ] && arduino --install-library "Adafruit SSD1325"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_SSD1331_OLED_Driver_Library_for_Arduino ] && arduino --install-library "Adafruit SSD1331 OLED Driver Library for Arduino"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_SSD1351_library ] && arduino --install-library "Adafruit SSD1351 library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_ST7735_and_ST7789_Library ] && arduino --install-library "Adafruit ST7735 and ST7789 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_STMPE610 ] && arduino --install-library "Adafruit STMPE610"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_TCS34725 ] && arduino --install-library "Adafruit TCS34725"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_Thermal_Printer_Library ] && arduino --install-library "Adafruit Thermal Printer Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_TiCoServo ] && arduino --install-library "Adafruit TiCoServo"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_TinyFlash ] && arduino --install-library "Adafruit TinyFlash"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_TinyRGBLCDShield ] && arduino --install-library "Adafruit TinyRGBLCDShield"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_TLC5947 ] && arduino --install-library "Adafruit TLC5947"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_TLC59711 ] && arduino --install-library "Adafruit TLC59711"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_TMP006 ] && arduino --install-library "Adafruit TMP006"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_TMP007_Library ] && arduino --install-library "Adafruit TMP007 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_TouchScreen ] && arduino --install-library "Adafruit TouchScreen"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_TPA2016_Library ] && arduino --install-library "Adafruit TPA2016 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_Trellis_Library ] && arduino --install-library "Adafruit Trellis Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_TSL2561 ] && arduino --install-library "Adafruit TSL2561"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_TSL2591_Library ] && arduino --install-library "Adafruit TSL2591 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_Unified_Sensor ] && arduino --install-library "Adafruit Unified Sensor"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_UNTZtrument ] && arduino --install-library "Adafruit UNTZtrument"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_VC0706_Serial_Camera_Library ] && arduino --install-library "Adafruit VC0706 Serial Camera Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_VCNL4010 ] && arduino --install-library "Adafruit_VCNL4010"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_VEML6070_Library ] && arduino --install-library "Adafruit VEML6070 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_VEML6075_Library ] && arduino --install-library "Adafruit VEML6075 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_VL53L0X ] && arduino --install-library "Adafruit_VL53L0X"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_VL6180X ] && arduino --install-library "Adafruit_VL6180X"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_VS1053_Library ] && arduino --install-library "Adafruit VS1053 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_WS2801_Library ] && arduino --install-library "Adafruit WS2801 Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_Zero_DMA_Library ] && arduino --install-library "Adafruit Zero DMA Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_Zero_FFT_Library ] && arduino --install-library "Adafruit Zero FFT Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_Zero_I2S_Library ] && arduino --install-library "Adafruit Zero I2S Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_Zero_PDM_Library ] && arduino --install-library "Adafruit Zero PDM Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Adafruit_ZeroTimer_Library ] && arduino --install-library "Adafruit ZeroTimer Library"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/U8g2_for_Adafruit_GFX ] && arduino --install-library "U8g2_for_Adafruit_GFX"
+sleep 1
+[ ! -d $HOME/Arduino/libraries/Wemos_Matrix_Adafruit_GFX ] && arduino --install-library "Wemos Matrix Adafruit GFX"
sleep 1
-[ ! -d $HOME/Arduino/libraries/Adafruit_AM_radio_library ] && arduino --install-library "Adafruit AM radio library"

original_message: add generated library list