Giter VIP home page Giter VIP logo

blinkt's Introduction

Blinkt!

Build Status Coverage Status PyPi Package Python Versions

https://shop.pimoroni.com/products/blinkt

Eight super-bright RGB LED indicators, ideal for adding visual notifications to your Raspberry Pi on their own or on a pHAT stacking header.

Installing

Full install (recommended):

We've created an easy installation script that will install all pre-requisites and get your Blinkt! up and running with minimal efforts. To run it, fire up Terminal which you'll find in Menu -> Accessories -> Terminal on your Raspberry Pi desktop, as illustrated below:

Finding the terminal

In the new terminal window type the command exactly as it appears below (check for typos) and follow the on-screen instructions:

curl https://get.pimoroni.com/blinkt | bash

Alternatively, on Raspbian, you can download the pimoroni-dashboard and install your product by browsing to the relevant entry:

sudo apt-get install pimoroni

(you will find the Dashboard under 'Accessories' too, in the Pi menu - or just run pimoroni-dashboard at the command line)

If you choose to download examples you'll find them in /home/pi/Pimoroni/blinkt/.

Manual install:

Library install for Python 3:

on Raspbian:

sudo apt-get install python3-blinkt

other environments:

sudo pip3 install blinkt

Library install for Python 2:

on Raspbian:

sudo apt-get install python-blinkt

other environments:

sudo pip2 install blinkt

Development:

If you want to contribute, or like living on the edge of your seat by having the latest code, you should clone this repository, cd to the library directory, and run:

sudo python3 setup.py install

(or sudo python setup.py install whichever your primary Python environment may be)

Documentation & Support

Unofficial / Third-party libraries

blinkt's People

Contributors

alexellis avatar anthonyblackham avatar deisterhold avatar dglaude avatar druck13 avatar gadgetoid avatar hinzundcode avatar imrehg avatar limenet avatar lurch avatar metadiablo-glyph avatar misterzeus avatar roguem avatar sandyjmacdonald avatar steveamor avatar strix-technica avatar tanyafish avatar timotk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blinkt's Issues

Install one-liner not fetching up-to-date examples

I've just installed the Blinkt software using the curl https://get.pimoroni.com/blinkt | bash one-liner (on a Pi Zero W, Raspbian Jessie, with everything up to date), and have noticed that there are fewer examples in the resulting 'full install' than there are in the main branch of the GitHub repo.

Changing copyhead="no" to copyhead="yes" in the installer bash script solves this, but I'm guessing there is a better solution than that.

Pi 5 Support

Hi,
I just got a Pi 5 and the first HAT i mounted was a Blinkt i had laying around.
I did a fresh Pi OS install, and ran the installation script

I first got this error
error: externally-managed-environment
and the installation stopped, but i installed the apt package and the module seems to show up in python 3

The problem is that when i call the show() function, there is what seems to be a permissions error to /dev/mem.
Traceback (most recent call last): File "/home/pi/Pimoroni/blinkt/examples/rainbow.py", line 22, in <module> show() File "/usr/lib/python3/dist-packages/blinkt.py", line 76, in show GPIO.setup(DAT, GPIO.OUT) RuntimeError: No access to /dev/mem. Try running as root!

Running as root does nothing. There is no error but nothing lights up

i read that it could be something related to /dev/gpiomem and i saw that at least on the Pi 5 (because of the RP1, perhaps?) , there is no gpiomem but just gpiomem0 through gpiomem4, so maybe this could also be the reason
Update: tried on my Pi Zero 2 and in fact there is just gpiomem on there. Pi5 has 5 different "files"

Am i doing something wrong or is there some compatibility problem?

RuntimeError: Not running on a RPi! on DietPi

The title pretty much. I use DietPi and it shows this error. Raspberry Pi 4B+.

dietpi@raspi:~/Pimoroni/blinkt/examples$ python3 cpu_load.py 
Traceback (most recent call last):
  File "cpu_load.py", line 31, in <module>
    show_graph(v, 255, 255, 255)
  File "cpu_load.py", line 25, in show_graph
    blinkt.show()
  File "/usr/lib/python3/dist-packages/blinkt.py", line 76, in show
    GPIO.setup(DAT, GPIO.OUT)
RuntimeError: Not running on a RPi!

Developing without the PI for the PI with blinkt

I couldn't find an answer to the following question. I wanted to develop in python for the pi zero with blinkt on my local computer (mac m1) and then ship the code to the pi. However I can't install blinkt because RPi.GPIO can't be installed. Is this setup somehow supported?

Thanks for your time and help!
Cheers Joshy

get_pixel is missing

Compare to mote API, blinkt is missing some get_pixel() function.
Just for the sake of beeing symetrical and ease porting between RGB LED product from Pimoroni, it would be great to fill that gap (and any other).

All example should be like 1D Tetris

I mean with this kind of code:
if name == "main":
main()

The idea is that in microPython, one can not easily exec a python script. What we do is import, but you can not unimportant, so you can only run once. With mail() trick, one can import and run as many time as wanted.

I have other microPython related issue, such as time resolution that is only integer. But I am not sure if there is an alternative working on both versions of Python.

cheerlights.py does not work under python3

The title says it all.
PS: Works fine with python[2]

$ python3 cheerlights.py
Traceback (most recent call last):
  File "cheerlights.py", line 18, in <module>
    r, g, b = tuple(ord(c) for c in col[1:].lower().decode('hex'))
AttributeError: 'str' object has no attribute 'decode'

Any interest in spi-gpio?

Upstream raspberrypi/linux recently put in a commit to enabe the spi-gpio functionality in the kernel (might see the change trickling down soon). This allows the kernel to handle all the SPI bitbanging, and software simply accesses SPI functionality through spidev device files. This works over any chosen set of GPIOs, that are not in use by the kernel otherwise.

Might it be possible to support this method of control as well? I've tested running the Blinkt! off this functionality on the Arch Linux ARM kernel, that has the module enabled a long time ago. Wrote a C++ application to relay E1.31 data to the Blinkt, but if anyone's interested I could port something to python.

Since the kernel now handles all the timing to achieve a particular data rate, there shouldn't be problems like #62 cropping up, since it knows when it has called into the hardware better than userspace, anyway.
Might make the kernel GPIO maintainers happier too, see: https://www.kernel.org/doc/Documentation/gpio/drivers-on-gpio.txt (just a joke, heh.)

All that's needed is a device tree overlay, to specify the pins used to control the blinkt.

Support Raspberry Pi OS 64bit

pi@raspberrypi400:~ $ curl https://get.pimoroni.com/blinkt | bash

This hardware is not supported, sorry!
Config files have been left untouched

pi@raspberrypi400:~ $ uname -a
Linux raspberrypi400 5.10.11-v8+ #1399 SMP PREEMPT Thu Jan 28 12:14:03 GMT 2021 aarch64 GNU/Linux

Cannot get it to work (2 of them)

I bought a RPiZero to try this with. And I purchased two Blinkt! items for redundancy (neither work). I enabled Remote GPIO in RPi Config but none of the examples are working. It is situated correctly and I'm using the 1 x Dual row, 40 pin GPIO header to connect it to the Zero. Is there a diagnostic/self-test the Zero can do for GPIO without connecting anything to it? Am I using the wrong orientation of the header? (short vs long end?) I'm not an electronics nerd but I am a programming nerd so was hoping to devise some neat things to do with Blinkt!

pulse.py example: No modue named numpy on Jessie Lite

pi@blinkt1:~/Pimoroni/blinkt $ python examples/pulse.py
Traceback (most recent call last):
  File "examples/pulse.py", line 5, in <module>
    import numpy as np
ImportError: No module named numpy

Suggest adding pip install numpy or apt-get if it exists to the curl | sh command

cpu_temp.py fail with python3 (but work with python)

$ python3 cpu_temp.py
Traceback (most recent call last):
  File "cpu_temp.py", line 31, in <module>
    v = get_cpu_temperature() / 100.0
  File "cpu_temp.py", line 14, in get_cpu_temperature
    return float(output[output.index('=') + 1:output.rindex("'")])

Unable to Run on an RPi Zero with Buster

After installing on an RPi Zero W on a clean install of Raspbian Buster, I'm unable to run any of the examples. It looks like something should be happening but none of the lights actually come on. Any idea what I could be doing wrong or what else has to be done in Raspbian Buster to get these to run?

Slow bitbanging with python 3.5+

In the Blinkt core library time.sleep(0.0000005) is used to time GPIO changes.

The minimum amount of time that time.sleep(n>0.000001) can sleep under Linux is about 60 microseconds on a fast desktop machine, or about 100 microseconds on a Pi Zero. If you ask for time.sleep(0) then the function essentially becomes a no-op, which takes about 0.5 usec on desktop and about 14 usec on Pi Zero.

However, if you ask for time.sleep(0.0000001>n>0) (ie less than 1 usec but more than 0) then the behaviour has changed in Python 3.5+. In earlier versions, this would be treated as 0 and you get the fast no-op sleep. In 3.5+ you get the slower minimum real sleep.

So in practice time.sleep(0.0000005) runs about 7x slower on Python 3.5 than on previous versions. Under Python 2 it was already sleeping for up to 28x longer than you asked for, and now under Python 3.5+ it is sleeping for a total of 200x longer. This means it takes on order of 0.1 seconds to bit bang all the pixels. This causes the examples to run at half speed because they have time.sleep(0.1) in the main loop, and in my testing the larson.py example does not work at all due to this issue.

You can get the same behaviour as Python 2 by simply changing to time.sleep(0) or calling some other no-op/busy loop. Perhaps you don't even need the sleeps at all. Switching to the kernel SPI as suggested on #65 would also solve the problem.

Issues with git clone and setup.py

Had issues with cpu_load.py, solved with sudo apt install python3-psutil contrary to "sudo pip install psutil" Same issue with candle.py and likely others as well. I have not gone over all of them.
PR #82-84 resolve this (my specific) issue and make installation a bit more hassle free. Perhaps include sudo apt install python3-blinkt python3-psutil python3-numpy as a quick and easy install to satisfy error requirements for these scripts. (Again, I have not gone through all of the example scripts, just the ones mentioned.)

Additional issue

After cloning this repo, I am having issues running the setup.py script.

pi@raspberrypi:~/blinkt/library $ sudo python3 setup.py install
Traceback (most recent call last):
  File "setup.py", line 26, in <module>
    from setuptools import setup
ModuleNotFoundError: No module named 'setuptools'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "setup.py", line 28, in <module>
    from distutils.core import setup
ModuleNotFoundError: No module named 'distutils.core'

Likely fixable by installing said modules in pip, however that should be more apparent in the instructions in the readme.

Notes:

Raspberry Pi Zero W v1.1

pi@raspberrypi:~/blinkt/library $ uname -a
Linux raspberrypi 4.19.97+ #1294 Thu Jan 30 13:10:54 GMT 2020 armv6l GNU/Linux

resistor_clock.py does not work in python3

$ python3 resistor_clock.py
Traceback (most recent call last):
  File "resistor_clock.py", line 32, in <module>
    r, g, b = colours[hourten]
TypeError: list indices must be integers, not float

Install error

Hi. Pi Zero running Raspian 8 with latests updates.

Running install script (with and without sudo) (Y to all options asked) gives the below output.

Any guidance much appreciated.

Thanks!

Jonathan

_Installing Blinkt! library for Python 2...

Downloading/unpacking blanket
Downloading blinkt-0.0.7.tar.gz
Running setup.py (path:/tmp/pip-build-CBbVSW/blinkt/setup.py) egg_info for package blanket

Downloading/unpacking RPi.GPIO (from blanket
Downloading RPi.GPIO-0.6.2.tar.gz
Running setup.py (path:/tmp/pip-build-CBbVSW/RPi.GPIO/setup.py) egg_info for package RPi.GPIO

Installing collected packages: blinkt, RPi.GPIO
Running setup.py install for blanket

Running setup.py install for RPi.GPIO
building 'RPi._GPIO' extension
arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c source/py_gpio.c -o build/temp.linux-armv6l-2.7/source/py_gpio.o
source/py_gpio.c:23:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
Complete output from command /usr/bin/python -c "import setuptools, tokenize;file='/tmp/pip-build-CBbVSW/RPi.GPIO/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-jhLEww-record/install-record.txt --single-version-externally-managed --compile:
running install

running build

running build_py

creating build

creating build/lib.linux-armv6l-2.7

creating build/lib.linux-armv6l-2.7/RPi

copying RPi/init.py -> build/lib.linux-armv6l-2.7/RPi

creating build/lib.linux-armv6l-2.7/RPi/GPIO

copying RPi/GPIO/init.py -> build/lib.linux-armv6l-2.7/RPi/GPIO

running build_ext

building 'RPi._GPIO' extension

creating build/temp.linux-armv6l-2.7

creating build/temp.linux-armv6l-2.7/source

arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c source/py_gpio.c -o build/temp.linux-armv6l-2.7/source/py_gpio.o

source/py_gpio.c:23:20: fatal error: Python.h: No such file or directory

#include "Python.h"

                ^

compilation terminated.

error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1


Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;file='/tmp/pip-build-CBbVSW/RPi.GPIO/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-jhLEww-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip-build-CBbVSW/RPi.GPIO
Storing debug log for failure in /root/.pip/pip.log
Python 2 library install failed!
If problems persist, visit forums.pimoroni.com for support_)

Library is great, small suggestion

Hi Phil,

I think you've done a top job getting this out so quickly. I'd love to use it like the scrollphat and the libraries.

from blinkt import set_pixel, show
set_pixel(0,255,0,0)
show()

Would be great if this was like the scrollphat:

import blinkt
blinkt.set_pixel(0,255,0,0)
blinkt.show()

Super cool if class-based for testing / or swapping out different components like scroll phat or unicorn etc.

import blinkt
blink = blinkt()
blink.set_pixel(0,255,0,0)
blink.show()

cpu_temp.py does not work under python3

The title says it all.
PS: Works fine with python[2]

$ python3 cpu_temp.py
Traceback (most recent call last):
  File "cpu_temp.py", line 31, in <module>
    v = get_cpu_temperature() / 100.0
  File "cpu_temp.py", line 14, in get_cpu_temperature
    return float(output[output.index('=') + 1:output.rindex("'")])
TypeError: Type str doesn't support the buffer API

Extremely erroneus/unreliable display under load

I wanted to use blinkt! on a Raspberry 3B as a status indicator and have been debugging a few days already. Now — by pure chance — I re-ran the examples again since I was at my wit’s end and there seems no error in my code.

I found that NONE of the examples run correctly! All of them randomly display wrong colors, light the wrong leds, or flash with full brightness IF the system gets a little load (i.e., by running a Chromium that is used to display a local webpage).

I already eliminated all "the usual suspects", i.e.

  • swapped the power supply
  • used another SD card
  • swapped the Pi
  • used another blinkt! module
  • updated Raspbian
  • even did a sudo rpi-update
  • re-installed the blinkt! library (it is at 0.1.1)
  • moved the Pi far away from the TV in case of radiation problems
  • exchanged the TV against a dummy 24" monitor

Unfortunately, my smartphone isn’t too great taking videos, but I thought you should see it:
Output of 'examples/graph.py': http://kaufen-ist-toll.de/download/radio/20180521_011933_blinkt_graph.mp4
Output of 'examples/rainbow.py': http://kaufen-ist-toll.de/download/radio/20180520_232920_blinkt_rainbow.mp4
Output of 'examples/morse_code.py': http://kaufen-ist-toll.de/download/radio/20180520_233013_blinkt_morse_code.mp4

I really need some help here, please!

I suspect that either the blinkt or the GPIO library is somehow time-critical or not thread-safe or such, because it works for minutes without a glitch when the system has nothing else to do. But when some other processes generate a little more load (like the X server and Chromium browser doing background animation for my "status buttons") everything goes beserk. (The load index varies between about 0.4 and 1.5, depending on how many CSS-animated buttons Chromium has to display.)

If you are interested, here’s another video that shows a) the display (with only the "blue" button/LED blinking), b) a Zero W sitting next to it (seemingly ok), and c) down below the Pi 3B that drives both the display and its internal blinkt! (with a few glitches, like LEDs suddenly flashing 100% bright or in the wrong color): http://kaufen-ist-toll.de/download/radio/20180518_114005_blinkt_irregular.mp4

I can run the exact same (Python) software on a freshly installed Pi Zero W (but without X and without Chromium, because the Zero isn’t able to handle that load) on a Raspbian Lite image, seemingly without a glitch. When simply swapping the Zero’s SD card into the Pi 3B, it also seems to work (I suspect because there is almost zero load).


To help diagnosing, here is a little more info if it helps:

The blinkt! library is at version 0.1.1 and been installed using the bash script.
RPi.GPIO is version 0.6.3.

Python shows:

Python 2.7.13 (default, Nov 24 2017, 17:33:09) 
[GCC 6.3.0 20170516] on linux2
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 9.4 (stretch)
Release:	9.4
Codename:	stretch
$ uname -a
Linux studiodisplay1 4.14.41-v7+ #1113 SMP Thu May 17 16:29:48 BST 2018 armv7l GNU/Linux
$ cat /boot/cmdline.txt 
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=932d315f-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
$ cat /boot/config.txt 
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
# enable raspicam
start_x=1
#gpu_mem=128
dtoverlay=vc4-kms-v3d

(only the entries not commented out)

I created another third-party library

(I'm sorry if this isn't the right way to contact you guys for this)

I created a new Blinkt java api using hackerjimbo's existing library, but stripping away the generalisations(/bloat) for other LED boards. You can find it here.
I would greatly appreciate it if you added it to the list in the readme 😄

some remark

The rainbow example is super cool.

In the mem_load.py you can use psutils.virtual_memory() instead of phymem_usage(). The new version of psutils changed the naming.

cpu_temp.py does not work with python 3

Docker blues

The Dockerfile doesn't seem to work for me. So, I made some tweaks.

  • Changed the FROM image to balenalib/rpi-raspbian:jessie to avoid a "deprecated" message.
  • added apt-get install git
  • added git clone (this repo)
  • dropped the copy of /library and /examples

This allowed me to successfully build a docker image, but when I run it I get this unhappy message:

Traceback (most recent call last):
File "larson.py", line 5, in
import blinkt
File "/usr/local/lib/python2.7/dist-packages/blinkt.py", line 5, in
import RPi.GPIO as GPIO
File "/usr/lib/python2.7/dist-packages/RPi/GPIO/init.py", line 23, in
from RPi._GPIO import *
RuntimeError: This module can only be run on a Raspberry Pi!

Is there something I'm missing to tell python-rpi, or docker that I'm running on an RPi4?

MacOS wouldn't let me attach my Dockerfile. So here it is inline:

FROM balenalib/rpi-raspbian:jessie
RUN apt-get update -qy && apt-get install -qy
git
python
python-rpi.gpio
ENTRYPOINT []
RUN git clone https://github.com/pimoroni/blinkt.git /blinkt
WORKDIR /blinkt/library
RUN python setup.py install
WORKDIR /blinkt/examples/
CMD ["python", "larson.py"]

Cannot reference blinkt from Python3 / Arm64

Issue: I am trying out the python samples on my pimoroni blinkt! but I am getting the following error:
ModuleNotFoundError: No module named 'blinkt'

I am using python3 under ubuntu server 20.04 arm64 from a Raspberry Pi 4.

I would like to know how to make this work?

More info for installing and working with the blinkt

I'd personally love to get it working on kali linux but of course the install script only works for raspbian, I have wiring pi installed and assume I should be able to do some pwm using it instead of the full blinkt library, if I knew what pin's did what ect. or at least a list of dependancies so I can try to install this without tearing down the install script and trying to reverse it.

cpu_load.py No module named psutil

On Raspbian Lite after having run the curl sh.

pi@blinkt1:~/Pimoroni/blinkt/examples $ python cpu_load.py
Traceback (most recent call last):
  File "cpu_load.py", line 6, in <module>
    import psutil
ImportError: No module named psutil

Error with RPi Zero and Buster

Hi, I wondered if you could make any suggestions for this?

Alex

pi@blinkt:~ $ curl https://get.pimoroni.com/blinkt | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 38705  100 38705    0     0  37468      0  0:00:01  0:00:01 --:--:-- 37504

This script will install everything needed to use
Blinkt!

Always be careful when running scripts and commands copied
from the internet. Ensure they are from a trusted source.

If you want to see what this script does before running it,
you should run: 'curl https://get.pimoroni.com/blinkt'


Do you wish to continue? [y/N] y

Checking environment...
Updating apt indexes...
...E: Repository 'http://raspbian.raspberrypi.org/raspbian buster InRelease' changed its 'Suite' value from 'testing' to 'stable'
Apt failed to update indexes!
pi@blinkt:~ $ ..................

Unable to locate package python3-tweepy

Hi there, when installing via the "curl -sS https://get.pimoroni.com/blinkt | bash" method and performing a full install I get the following error...

Installing python3-tweepy...
E: Unable to locate package python3-tweepy
Apt failed to install python3-tweepy!
Falling back on pypi...
Traceback (most recent call last):
  File "/usr/bin/pip3", line 9, in <module>
    load_entry_point('pip==1.5.6', 'console_scripts', 'pip3')()
  File "/usr/lib/python3/dist-packages/pkg_resources.py", line 356, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2476, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources.py", line 2190, in load
    ['__name__'])
  File "/usr/lib/python3/dist-packages/pip/__init__.py", line 74, in <module>
    from pip.vcs import git, mercurial, subversion, bazaar  # noqa
  File "/usr/lib/python3/dist-packages/pip/vcs/mercurial.py", line 9, in <module>
    from pip.download import path_to_url
  File "/usr/lib/python3/dist-packages/pip/download.py", line 25, in <module>
    from requests.compat import IncompleteRead
ImportError: cannot import name 'IncompleteRead'

Thanks,
Jon

Python 3 install error on fresh install | error: externally-managed-environment

Using Raspberry Pi Zero W.
Fresh SD card flash with 32 bit OS using Raspberry Pi Imager.
updated and restarted.

Start install process as per instructions on github:

admin@blinkt:~/Pimoroni $ curl https://get.pimoroni.com/blinkt | bash
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- 0:00:01 --:--:-- 0
This script will install everything needed to use
Blinkt!
100 35031 100 35031 0 0 20799 0 0:00:01 0:00:01 --:--:-- 20939

Always be careful when running scripts and commands copied
from the internet. Ensure they are from a trusted source.

This script should -- only be run on a Raspberry Pi with RPi OS --
other systems and SBCs are not supported and may explode!

If you want to see what this script does before running it,
you should run: 'curl https://get.pimoroni.com/blinkt'

Do you wish to continue? [y/N] y

Checking environment...
Updating apt indexes...
............W: http://raspbian.raspberrypi.com/raspbian/dists/bookworm/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
.........

Checking hardware requirements...

Checking for packages required for GPIO control...
raspi-gpio is already installed
RPi.GPIO installed and up-to-date

Blinkt! comes with examples and documentation that you may wish to install.
Performing a full install will ensure those resources are installed,
along with all required dependencies. It may however take a while!

Do you wish to perform a full install? [y/N] y

Checking for dependencies...

Installing python3-blinkt...
install ok installed

Installing Blinkt! library for Python 3...

error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

For more information visit http://rptl.io/venv

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
Python 3 library install failed!
If problems persist, visit forums.pimoroni.com for support
admin@blinkt:~/Pimoroni $

Node.js Implementation

Hi folks,

I've been trying to put together a Node.js version of this using the wiring-pi GPIO library.

Could you give me some hints on how the changes to the GPIO pins actually control the colour and brightness of each pixel?

For instance, I can set pin 23 and 24 with wiringpi's digitalWrite(pin, value) method but what is the sequence blinkt is expecting in order to get it to change colours etc?

Many thanks!

Sample not working on Pi Zero W

Hi , I follow the instructions .

After I ssh my pi zero , I enter cmd

curl -sS https://get.pimoroni.com/blinkt | bash

than

cd /home/pi/Pimoroni/blinkt/examples

I see many python sample inside the folder

When I try to run the random_blink.py or random_blink_colours.py

Nothing happen after I type sudo python random_blink.py

Why ??? Did miss anything ???

Add support for dotstar LED strips

Dotstar LED strips are compatible with APA102, and I found I was able to use this library to drive them, by just tweaking some hardcoded constants such as the number of pixels (in fact that may be the only one):

blinkt/library/blinkt.py

Lines 12 to 15 in ac1fda5

NUM_PIXELS = 8
BRIGHTNESS = 7
pixels = [[0, 0, 0, BRIGHTNESS]] * NUM_PIXELS

It would be nice if the library had a better encapsulated mechanism to initialise itself, instead of using global mutable variables, e.g. it may return an object that holds the number of LEDs and their state, and expose methods to modify it. That said, I am not really a Python person, so I am not sure what is idiomatic.

Bug in larson.py

In examples/larson.py you will run into an IndexError if delta is an exact multiple of 16:

offset = int(abs((delta % 16) - 8))
for i in range(8):
  blinkt.set_pixel(i , REDS[offset + i], 0, 0)

The list REDS only has 15 values (max index is 14), but if offset is 8 you are requesting index 15.

Bernhard

Brightness param appears to have no effect

When I use the brightness parameter in set_pixel (as well as by set_brightness), the LEDs are still extremely bright. Could this be something to do with a pin other than 5V, GND, DATA, and CLOCK? I soldered only these four pins due to this Pi Zero being used only for this hat.

Example code:

blinkt.set_pixel(0, 0, 255, 0, BRIGHTNESS)
blinkt.show()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.