-
- #Sample Code for Light Sensor Found at http://www.uugear.com/portfolio/using-light-sensor-module-with-raspberry-pi/
-
- import RPi.GPIO as GPIO
-
- GPIO.setmode(GPIO.BCM)
- GPIO.setup(4,GPIO.IN)
-
- for i in range(0,5):
- print GPIO.input(4)
-
-
- #Im trying to use the light sensor to change the brightness in a script I have for a string of Ws2811x LEDs
-
- #Does the LED_BRIGHTNESS code make sense? I really have no idea what I'm doing.
-
- import urllib2
- import xml.etree.ElementTree as ET
- import time
- from neopixel import *
- import sys
- import os
- #Light Sensor Code
- import RPi.GPIO as GPIO
- GPIO.setmode(GPIO.BCM)
- GPIO.setup(4,GPIO.IN)
-
-
- # LED strip configuration:
- LED_COUNT = 95 # Number of LED pixels.
- LED_PIN = 18 # GPIO pin connected to the pixels (18 uses PWM!).
- #LED_PIN = 10 # GPIO pin connected to the pixels (10 uses SPI /dev/spidev0.0).
- LED_FREQ_HZ = 800000 # LED signal frequency in hertz (usually 800khz)
- LED_DMA = 5 # DMA channel to use for generating signal (try 5)
- for i in range(0,5):
- print LED_BRIGHTNESS = 100 # Set to 0 for darkest and 255 for brightest
- for i in range(3,5):
- print LED_BRIGHTNESS = 255
- 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
-
-
-
-
- strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL, LED_STRIP)
-
-
- strip.begin()
-