2 thoughts on “NiteLite: PIR motion detection, and random LED pattern selection

  1. If I’m not using the motion detection, and wanting the twinkle pattern, how would I do that? Thanks, your Pi looks amazing!

    • Do you have the code? If so, removing these lines

      #------------------------------------------------------------
      # Set up the PIR movement detection callback
      #------------------------------------------------------------
      def PIRCallback(channel):
      	global motion_detected_time
      	global led_pattern
      	global leds
      
      	if led_pattern == LED_PATTERN_TWINKLE:
      		led_pattern = random.randint(1, 4)
      	motion_detected_time = time.time()
      
      #------------------------------------------------------------
      # Set up the PIR movement detection
      #------------------------------------------------------------
      GPIO_PIR = 18
      GPIO.setmode(GPIO.BOARD)
      GPIO.setup(GPIO_PIR, GPIO.IN, GPIO.PUD_DOWN)
      GPIO.add_event_detect(GPIO_PIR, GPIO.RISING, PIRCallback, 0)
      

      will mean only the twinkles will run. Once that works you can find and delete the other bits of related to what happens when motion’s detected

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.