Advertisement
OreganoHauch

LEDBlinkFadeInFadeOut

May 27th, 2022
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. import time
  2. from rpi_ws281x import PixelStrip, Color
  3. import argparse
  4. import RPi.GPIO as GPIO
  5. import board
  6. import neopixel
  7.  
  8.  
  9. # LED strip configuration:
  10. LED_COUNT = 150 # Number of LED pixels.
  11. LED_PIN = 18 # GPIO pin connected to the pixels (18 uses PWM!).
  12. # LED_PIN = 10 # GPIO pin connected to the pixels (10 uses SPI /dev/spidev0.0).
  13. LED_FREQ_HZ = 800000 # LED signal frequency in hertz (usually 800khz)
  14. LED_DMA = 10 # DMA channel to use for generating signal (try 10)
  15. LED_BRIGHTNESS = 255 # Set to 0 for darkest and 255 for brightest
  16. LED_INVERT = False # True to invert the signal (when using NPN transistor level shift)
  17. LED_CHANNEL = 0 # set to '1' for GPIOs 13, 19, 41, 45 or 53
  18.  
  19.  
  20. # Create NeoPixel object with appropriate configuration.
  21. strip = PixelStrip(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL)
  22. # Intialize the library (must be called once before other functions).
  23. strip.begin()
  24.  
  25. print("BEENDE...")
  26. pixels = neopixel.NeoPixel(board.D18, 150)
  27. pixels.fill((255,255,255))
  28. time.sleep(0.5)
  29. pixels.fill((0,0,0))
  30. time.sleep(0.5)
  31. pixels.fill((155,155,155))
  32. time.sleep(0.5)
  33. pixels.fill((0,0,0))
  34. time.sleep(0.5)
  35. pixels.fill((55,55,55))
  36. time.sleep(0.5)
  37. pixels.fill((0,0,0))
  38. for b in range(0,256):
  39. pixels.fill((b, b, b))
  40. for d in range(0,256):
  41. pixels.fill((255-d, 255-d, 255-d))
  42. if d%10 = 0:
  43. print(d)
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement