Skip to content

Commit

Permalink
patch Led do_light
Browse files Browse the repository at this point in the history
  • Loading branch information
juanvallejo committed Feb 28, 2016
1 parent 5cdde0b commit a25c352
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions led_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ class Led:
def __init__(self):

# LED configuration
LED_CHANNEL = 0
LED_COUNT = 16 # LEDs to light
LED_FREQ_HZ = 800000 # Frequency of LED signal (800khz | 400khz)
LED_DMA_NUM = 5 # DMA channel to use (0 - 14)
LED_GPIO = 18 # Pin connected to the signal line (PWM)
LED_BRIGHTNESS = 255 # 0 is dark, 255 is hella bright nigga
LED_INVERT = 0 # 1 inverts LED signal
self.LED_CHANNEL = 0
self.LED_COUNT = 16 # LEDs to light
self.LED_FREQ_HZ = 800000 # Frequency of LED signal (800khz | 400khz)
self.LED_DMA_NUM = 5 # DMA channel to use (0 - 14)
self.LED_GPIO = 18 # Pin connected to the signal line (PWM)
self.LED_BRIGHTNESS = 255 # 0 is dark, 255 is hella bright nigga
self.LED_INVERT = 0 # 1 inverts LED signal

# Define colors to be used (unsigned 32-bit int value
DOT_COLORS = [
self.DOT_COLORS = [
0x100010 # purple
]

Expand All @@ -34,15 +34,15 @@ def __init__(self):
ws.ws2811_channel_t_brightness_set(channel, 0)


channel = ws.ws2811_channel_get(self.leds, LED_CHANNEL)
channel = ws.ws2811_channel_get(self.leds, self.LED_CHANNEL)

ws.ws2811_channel_t_count_set(channel, LED_COUNT)
ws.ws2811_channel_t_gpionum_set(channel, LED_GPIO)
ws.ws2811_channel_t_invert_set(channel, LED_INVERT)
ws.ws2811_channel_t_brightness_set(channel, LED_BRIGHTNESS)
ws.ws2811_channel_t_count_set(channel, self.LED_COUNT)
ws.ws2811_channel_t_gpionum_set(channel, self.LED_GPIO)
ws.ws2811_channel_t_invert_set(channel, self.LED_INVERT)
ws.ws2811_channel_t_brightness_set(channel, self.LED_BRIGHTNESS)

ws.ws2811_t_freq_set(self.leds, LED_FREQ_HZ)
ws.ws2811_t_dmanum_set(self.leds, LED_DMA_NUM)
ws.ws2811_t_freq_set(self.leds, self.LED_FREQ_HZ)
ws.ws2811_t_dmanum_set(self.leds, self.LED_DMA_NUM)

# Initialize library with LED configuration.
self.resp = ws.ws2811_init(self.leds)
Expand All @@ -56,7 +56,7 @@ def do_light(self):
try:
offset = 0
while True:
color = DOT_COLORS[0]
color = self.DOT_COLORS[0]
# Set the LED color buffer value.
ws.ws2811_led_set(channel, 0, color)

Expand Down

0 comments on commit a25c352

Please sign in to comment.