Ich habe da ein Problem für das ich keine Lösung finde.
Immer wenn ich mein kitt.py Script laufen lasse. Bricht es nach einiger Zeit mit folgender Fehlermeldung ab.
*** glibc detected *** python: free(): invalid pointer: 0x0113ad68 ***
Diese Script habe ich zum testen der RASPI NEOPIXEL Libary umgeschrieben und soll das Knight Rider Lauflicht imitieren.
Andere Scripte in denen ich die Libary importierte, brechen nicht mit einer Fehlermeldung ab.
Kann mir jemand sagen wo der Fehler zu finden ist und wie ich ihn ggf. ausmerzen kann?
Vielen Dank im Voraus.
Code: Alles auswählen
#!/usr/bin/env python
import time
from neopixel import *
# LED strip configuration:
LED_COUNT = 15 # Number of LED pixels.
LED_PIN = 12 # 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 5)
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)
ZEIT = 800.0
FARBE = 255
FARBE = FARBE/4
FARBE2 = FARBE/8
# Define functions which animate LEDs.
def ledOff(strip, color):
for i in range(LED_COUNT):
strip.setPixelColor(i, Color(0, 0, 0))
strip.show()
# Check & start all LEDs.
def ledKitt(strip, color, wait_ms=50):
for k in range(strip.numPixels()):
strip.setPixelColor(k, color)
strip.show()
time.sleep(wait_ms/200.0)
for l in range(strip.numPixels()):
ledOff(strip, color)
# Runing order.
for x in range(1, LED_COUNT, 1):
for i in range(strip.numPixels()):
if i == (LED_COUNT):
strip.setPixelColor((LED_COUNT), color)
else:
y=i
strip.setPixelColor(i, color)
y=y-1
strip.setPixelColor(y, Color((FARBE), 0, 0))
y=y-1
strip.setPixelColor(y, Color((FARBE2), 0, 0))
strip.show()
time.sleep(wait_ms/ZEIT)
strip.setPixelColor(y, Color(0, 0, 0))
for j in range((LED_COUNT), -1, -1):
if j == (LED_COUNT):
strip.setPixelColor((LED_COUNT), color)
else:
y=j
strip.setPixelColor(j, color)
y=y+1
strip.setPixelColor(y, Color((FARBE), 0, 0))
y=y+1
strip.setPixelColor(y, Color((FARBE2), 0, 0))
strip.show()
time.sleep(wait_ms/ZEIT)
strip.setPixelColor(y, Color(0, 0, 0))
# Main program logic follows:
if __name__ == '__main__':
# Create NeoPixel object with appropriate configuration.
strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS)
# Intialize the library (must be called once before other functions).
strip.begin()
print 'Press Ctrl-C to quit.'
while True:
try:
ledKitt(strip, Color(255, 0, 0))
finally:
ledOff(strip, Color(0, 0, 0))
exit(0)
Vielleicht hat jemand noch einen Tipp oder einen Verbesserungsvorschlag.