Vielen dank
Posts by matze1
-
-
Ich muss das Thema nochmal aufholen. Ich habe genau das gleiche Problem mit aktuellen Raspbian stretch lite.
sagt mir:
Codepi@raspberrypi:~ $ apt-cache policy lirc lirc: Installiert: 0.9.4c-9 Installationskandidat: 0.9.4c-9 Versionstabelle: *** 0.9.4c-9 500 500 http://raspbian.raspberrypi.org/raspbian stretch/main armhf Packages 100 /var/lib/dpkg/status
Wie kann man Lirc restarten?
-
Ich habe jetzt nochmal das lite Image heruntergeladen und neu auf die sd Card geschrieben, dann genau das selbe gemacht wie Hofei beschrieben.
Aber wieder:
ImportError: No module named 'neopixel'
Edit:
wenn ich sudo python3 setup.py install versuche, dann gibt er mir folgendes aus:
Code
Display Morepi@raspberrypi:~/rpi_ws281x/python$ sudo python3 setup.py install Downloading https://pypi.python.org/packages/source/s/setuptools/setuptools-5.7.zip Extracting in /tmp/tmpftxzuwi3 Traceback (most recent call last): File "/home/pi/rpi_ws281x/python/ez_setup.py", line 138, in use_setuptools import pkg_resources ImportError: No module named 'pkg_resources' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "setup.py", line 4, in <module> use_setuptools() File "/home/pi/rpi_ws281x/python/ez_setup.py", line 140, in use_setuptools return _do_download(version, download_base, to_dir, download_delay) File "/home/pi/rpi_ws281x/python/ez_setup.py", line 120, in _do_download _build_egg(egg, archive, to_dir) File "/home/pi/rpi_ws281x/python/ez_setup.py", line 62, in _build_egg with archive_context(archive_filename): File "/usr/lib/python3.5/contextlib.py", line 59, in __enter__ return next(self.gen) File "/home/pi/rpi_ws281x/python/ez_setup.py", line 100, in archive_context with ContextualZipFile(filename) as archive: File "/home/pi/rpi_ws281x/python/ez_setup.py", line 88, in __new__ return zipfile.ZipFile(*args, **kwargs) File "/usr/lib/python3.5/zipfile.py", line 1026, in __init__ self._RealGetContents() File "/usr/lib/python3.5/zipfile.py", line 1094, in _RealGetContents raise BadZipFile("File is not a zip file") zipfile.BadZipFile: File is not a zip file You have new mail in /var/mail/pi
-
Jetzt muss ich nochmal den Thread fortsetzen, Ich bekomme das Python Modul (rpi_ws281x) nicht zum laufen (mit einer früheren Version (März) hat es funktioniert).
Und Zwar habe ich auf meinen Raspberry zero W das aktuelle Raspbian lite drauf, update und upgrade gemacht, dann folgendes installiert:
sudo apt-get install build-essential python-dev git scons swig
git clone https://github.com/jgarff/rpi_ws281x.git
cd rpi_ws281x
scons
cd python # (da kommt dann 'no such file or directory', aber wenn ich "cd /usr/local/lib/python2.7" dann gehts)
sudo python setup.py install # (dann hat er die Datei oder Verzeichnis auch nicht gefunden)
Im Home Ordner ist jetzt der Ordner "rpi_ws281x" vorhanden, aber beim Script ausführen, dann erscheint nur "ImportError: No module named 'neopixel'".
Kopiere ich den Ordner "neopixel" aber im 'Home'-Verzeichnis, dann findet er nicht den Ordner '_rpi_ws281x', der ist nämlich überhaupt nicht vorhanden.
Was gibt es jetzt für Alternativen?
-
So jetzt habe ich es mit einen WS2811 rgb led band versucht und es funktioniert so wie es soll, nur beim anschaltes des raspbery pi leuchtet die 1. Lampe. Beim prüfen kam raus, das bei GPIO 18 auch Strom floss. Kann man das irgendwie ausschalten?
-
Ja mit der 0, das ist die 1. LED. Die wird dann grün statt blau u.s.w.
Auch wenn ich den Farben-Wert verändere, dann leuchtet auf einmal ne andere und solche Geschichten.
Ich werde mir mal ein original Led band WS2811 holen, und schauen ob es da genau so ist.
-
Jetzt habe ich damit rumgespielt und musste feststellen, dass das nicht ganz hinhaut mit den Farben, rot geht super, aber wenn ich jetzt die Farbe grün des 4. LED (hab heut insgesamt 7 LED hintereinander gelötet) anpeile, dann leuchtet die 3. LED ganz leicht blau mit.
Und die 1. LED hat immer ne ganz andere Farbe. Ist das auf Produkt - Mangel zurückzuführen oder ist das generell so bei PWM?
-
Ok. Ich habe sonst immer über samba oder nfs freigaben mit IDLE Python Scripte erstellt, also direkt auf dem Pi zugegriffen. Wenns schnell gehen muss hab ich immer "nano" genommen.
-
Ich benutze nano, was empfehlst du?
-
Es war doch das kopieren, hab das jetzt mal selbst geschrieben, jetzt gehts.
-
Teilweise mehr Zeilen und teilweise nur 1 Zeile.
-
Das ist es auch nicht, hab es gerade probiert. Kann es sein, dass das etwas mit dem kopieren zu tun hat?
Ich kopiere das nämlich immer nur.
Da hatte ich vor längerer Zeit mal so ein Fall...
-
-
Ja hatte da was geändert.
Jetzt sieht der Code so aus:
Python
Display Moreimport time from neopixel import * # LED strip configuration: LED_COUNT = 3 # Number of LED pixels. LED_PIN = 18 # GPIO pin connected to the pixels (must support PWM!). LED_FREQ_HZ = 800000 # LED signal frequency in hertz (usually 800khz) LED_DMA = 5 # DMA channel to use for generating signal (try 10) LED_BRIGHTNESS = 255 # Set to 0 for darkest and 255 for brightest # True to invert the signal (when using NPN transistor level shift) LED_INVERT = False LED_CHANNEL = 0 # set to '1' for GPIOs 13, 19, 41, 45 or 53 LED_STRIP = ws.WS2811_STRIP_RGB # Strip type and colour ordering strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS) strip.begin() strip.setPixelColor(2, Color(255, 0, 0) strip.show() time.sleep(5)
Fehlermeldung:
-
Das hat geklappt, hab es leider übersehen.
Mit jeglicher Funktion klappt das alles gut, aber wenn ich versuche eine LED einfach zum leuchten zu bringen, dann klappt das nicht.
Entweder sagt er mir "SyntaxError: invalid syntax" oder "segmentation fault".
In Neopixel kann man wohl keine einfachen Befehle machen?
Hier mal der einfache Code:
Python
Display Moreimport time from neopixel import * # LED strip configuration: LED_COUNT = 3 # Number of LED pixels. LED_PIN = 18 # GPIO pin connected to the pixels (must support PWM!). LED_FREQ_HZ = 800000 # LED signal frequency in hertz (usually 800khz) LED_DMA = 5 # DMA channel to use for generating signal (try 10) LED_BRIGHTNESS = 255 # Set to 0 for darkest and 255 for brightest # True to invert the signal (when using NPN transistor level shift) LED_INVERT = False LED_CHANNEL = 0 # set to '1' for GPIOs 13, 19, 41, 45 or 53 LED_STRIP = ws.WS2811_STRIP_RGB # Strip type and colour ordering strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS) strip.begin() strip.show() strip.setPixelColor(2, Color(255, 0, 0) time.sleep(5)
-
So hab mir mal paar einzelne SMD RGB's mit PWM bestellt, bekommen und kurzer Hand zusammengelötet, funktioniert beim Test soweit auch alles gut.
Nur die LED's gehen nicht wieder aus. Hab schon mit "cleanup()", _cleanup(), strip.cleanup() u.s.w. versucht. Auch in der Doku finde ich nichts brauchbares.
Muss jedes mal den Pi komplett vom Strom trennen. Nicht einmal reboot löst das Problem.
-
Ich werde es demnächst mal in der Praxis testen, falls noch kleine Fragen auftauchen wo ich absolut nicht weiter komm, kann ich ja nochmal fragen.
-
Ich hab das hier gefunden, ist aber nicht für Python oder?
-
Hast du zufällig ein guten Link auf die Beschreibung?
-
Ich hab mich ein wenig mit "neopixel" beschäftigt.
Aber so richtig hab ich nicht herausgefunden wie man LED einzeln steuern kann (Helligkeit, Farbe u.s.w.)
Nehmen wir mal an, ich hab ein LED ws281x Band mit 10 RGB LED.
Jetzt möchte ich die 2. und 6. mit blau leuchten lassen. Da bekomme ich schon Schwierigkeiten.
Einzig das hier ist mir einleuchtend:
Code# LED strip configuration: LED_COUNT = 10 # Number of LED pixels. LED_BRIGHTNESS = 255 # Set to 0 for darkest and 255 for brightest LED_INVERT = False # True to invert the signal (when using NPN transistor level shift) LED_CHANNEL = 0 # set to '1' for GPIOs 13, 19, 41, 45 or 53 -LED_STRIP = ws.WS2811_STRIP_GRB # Strip type and colour ordering