From 6074addfdcf6b21009e4e04b05893de96b856278 Mon Sep 17 00:00:00 2001 From: druck Date: Mon, 26 Aug 2019 17:40:08 +0100 Subject: [PATCH 1/4] Neopixel programns moved to examples subdirectory --- examples/{ => neopixel}/grbw.py | 0 examples/{ => neopixel}/half.py | 0 examples/{ => neopixel}/max.py | 0 examples/{ => neopixel}/neopixels.py | 0 examples/{ => neopixel}/off.py | 0 examples/{ => neopixel}/setall.py | 0 examples/{ => neopixel}/white.py | 0 7 files changed, 0 insertions(+), 0 deletions(-) rename examples/{ => neopixel}/grbw.py (100%) rename examples/{ => neopixel}/half.py (100%) rename examples/{ => neopixel}/max.py (100%) rename examples/{ => neopixel}/neopixels.py (100%) rename examples/{ => neopixel}/off.py (100%) rename examples/{ => neopixel}/setall.py (100%) rename examples/{ => neopixel}/white.py (100%) diff --git a/examples/grbw.py b/examples/neopixel/grbw.py similarity index 100% rename from examples/grbw.py rename to examples/neopixel/grbw.py diff --git a/examples/half.py b/examples/neopixel/half.py similarity index 100% rename from examples/half.py rename to examples/neopixel/half.py diff --git a/examples/max.py b/examples/neopixel/max.py similarity index 100% rename from examples/max.py rename to examples/neopixel/max.py diff --git a/examples/neopixels.py b/examples/neopixel/neopixels.py similarity index 100% rename from examples/neopixels.py rename to examples/neopixel/neopixels.py diff --git a/examples/off.py b/examples/neopixel/off.py similarity index 100% rename from examples/off.py rename to examples/neopixel/off.py diff --git a/examples/setall.py b/examples/neopixel/setall.py similarity index 100% rename from examples/setall.py rename to examples/neopixel/setall.py diff --git a/examples/white.py b/examples/neopixel/white.py similarity index 100% rename from examples/white.py rename to examples/neopixel/white.py From a0f823d7fbf53eed121ed4cb01d86182f2c99d60 Mon Sep 17 00:00:00 2001 From: druck Date: Mon, 11 May 2020 01:13:11 +0100 Subject: [PATCH 2/4] Changed up/down arrow key directions --- examples/pantiltweb/templates/gui.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/pantiltweb/templates/gui.html b/examples/pantiltweb/templates/gui.html index 247d629..df8f752 100644 --- a/examples/pantiltweb/templates/gui.html +++ b/examples/pantiltweb/templates/gui.html @@ -63,12 +63,12 @@

Pan Tilt HAT: Web Interface

switch(e.keyCode){ case 38: // Arrow Up current_direction = 'tilt'; - current_angle = 1; + current_angle = -1; interval = setInterval(pantilt,pantilt_speed); break; case 40: // Arrow Down current_direction = 'tilt'; - current_angle = -1; + current_angle = 1; interval = setInterval(pantilt,pantilt_speed); break; case 37: // Arrow Left From e858a5bb8543e68d87a10d027f85f60a13099aa0 Mon Sep 17 00:00:00 2001 From: druck Date: Sun, 26 Jun 2022 15:24:43 +0100 Subject: [PATCH 3/4] Programs changed to Python3 by default for bullseye which no longer has Python2. Python2 support has not been removed, and documentation not updated --- examples/neopixel/grbw.py | 2 +- examples/neopixel/half.py | 2 +- examples/neopixel/max.py | 2 +- examples/neopixel/neopixels.py | 2 +- examples/neopixel/off.py | 2 +- examples/neopixel/setall.py | 2 +- examples/neopixel/white.py | 2 +- examples/pantiltweb/pantiltweb.py | 2 +- examples/smooth.py | 2 +- examples/timeout.py | 2 +- neopixel-blinkt/setup.py | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/examples/neopixel/grbw.py b/examples/neopixel/grbw.py index 23f7cfa..5e63b28 100755 --- a/examples/neopixel/grbw.py +++ b/examples/neopixel/grbw.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import colorsys import math diff --git a/examples/neopixel/half.py b/examples/neopixel/half.py index 0dc123b..e0a6518 100755 --- a/examples/neopixel/half.py +++ b/examples/neopixel/half.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import pantilthat diff --git a/examples/neopixel/max.py b/examples/neopixel/max.py index 475e6cc..078bde6 100755 --- a/examples/neopixel/max.py +++ b/examples/neopixel/max.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import pantilthat diff --git a/examples/neopixel/neopixels.py b/examples/neopixel/neopixels.py index e5013d9..9a49fee 100755 --- a/examples/neopixel/neopixels.py +++ b/examples/neopixel/neopixels.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import colorsys import math diff --git a/examples/neopixel/off.py b/examples/neopixel/off.py index 2b7edd0..21479c7 100755 --- a/examples/neopixel/off.py +++ b/examples/neopixel/off.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import pantilthat diff --git a/examples/neopixel/setall.py b/examples/neopixel/setall.py index 49a84ce..8ce40e3 100755 --- a/examples/neopixel/setall.py +++ b/examples/neopixel/setall.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys from sys import argv diff --git a/examples/neopixel/white.py b/examples/neopixel/white.py index ac1708a..cd47285 100755 --- a/examples/neopixel/white.py +++ b/examples/neopixel/white.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import pantilthat diff --git a/examples/pantiltweb/pantiltweb.py b/examples/pantiltweb/pantiltweb.py index 9d819f3..84636e7 100755 --- a/examples/pantiltweb/pantiltweb.py +++ b/examples/pantiltweb/pantiltweb.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import pantilthat from sys import exit diff --git a/examples/smooth.py b/examples/smooth.py index 5209cd5..5e3d892 100755 --- a/examples/smooth.py +++ b/examples/smooth.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import math import time diff --git a/examples/timeout.py b/examples/timeout.py index c8dd324..598db35 100755 --- a/examples/timeout.py +++ b/examples/timeout.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import time diff --git a/neopixel-blinkt/setup.py b/neopixel-blinkt/setup.py index 1c24f14..bd300a1 100755 --- a/neopixel-blinkt/setup.py +++ b/neopixel-blinkt/setup.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ Copyright (c) 2016 Pimoroni. From b56ea91b1da1ed34b109cbc30f7d3f2e9f0dda74 Mon Sep 17 00:00:00 2001 From: druck Date: Sun, 26 Jun 2022 18:07:21 +0100 Subject: [PATCH 4/4] Added get_pixel for kitt example --- neopixel-blinkt/blinkt.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/neopixel-blinkt/blinkt.py b/neopixel-blinkt/blinkt.py index 483102b..0451b7b 100644 --- a/neopixel-blinkt/blinkt.py +++ b/neopixel-blinkt/blinkt.py @@ -7,6 +7,7 @@ _clear_on_exit = True _brightness = 0.2 NUM_PIXELS = 8 +pixels = [[0, 0, 0, _brightness]] * NUM_PIXELS def _exit(): if _clear_on_exit: @@ -28,6 +29,7 @@ def set_brightness(brightness): def clear(): + pixels[:] = [[0, 0, 0, _brightness]] * NUM_PIXELS pantilthat.clear() @@ -39,13 +41,17 @@ def set_all(r, g, b, brightness=None): global _brightness if brightness is not None: _brightness = brightness + pixels[:] = [[r, g, b, _brightness]] * NUM_PIXELS pantilthat.set_all(int(r*_brightness), int(g*_brightness), int(b*_brightness)) +def get_pixel(x): + return pixels[0] def set_pixel(x, r, g, b, brightness=None): global _brightness if brightness is not None: _brightness = brightness + pixels[x] = [r, g, b, _brightness] pantilthat.set_pixel(x, int(r*_brightness), int(g*_brightness), int(b*_brightness))