Procedural LED Example - led.update() Method

Hello again,

BiblioPixel newbie here! I am working with a simple LED strip code example given to me that uses the update() method. My understanding from reading the wiki was that animations need to be written separately from layouts. I also see in the error message from running the program that the update() method is deprecated. I checked in the Strip class for a successor and didn’t see one. I am not sure if I just need to modify this program or redo it in a totally different format.

Is this form of program still supported/valid? I like how the script is simple and lets students program the LEDs procedurally, so I would like to keep this kind of format if that is still supported. If it is out of date, what would be the steps/best practices for updating it?

Here is the important part of the program: (demo-test.py)

### Initial setup

numStrips = 1

numLeds= 10 * numStrips

driver=DriverLPD8806(numLeds, ChannelOrder.BRG, False)

led=LEDStrip(driver)

### Each LED turns on serially

####Once done they all flash ON & OFF till user ends the program with CTRL + C

led.fillRGB(0,0,0) # turns everything off

led.update()

Pick Random Color

color = (random.randint(1,180), random.randint(1,180), random.randint(1,180))

for i in range (numLeds):

print ('LED '+str(i+1))

led.set(i, color)

led.update()

time.sleep(0.25)

``

Error message when running: ($ python demo-test.py)

WARNING - deprecated - Layout.update

Traceback (most recent call last):

File “demo-test.py”, line 36, in

led.update()

File “/anaconda/lib/python3.6/site-packages/bibliopixel/layout/layout.py”, line 70, in update

return self.push_to_driver()

File “/anaconda/lib/python3.6/site-packages/bibliopixel/layout/layout.py”, line 162, in push_to_driver

self.threading.push_to_driver()

File “/anaconda/lib/python3.6/site-packages/bibliopixel/util/threads/update_threading.py”, line 93, in push_to_driver

self.update_colors()

File “/anaconda/lib/python3.6/site-packages/bibliopixel/util/threads/update_threading.py”, line 83, in update_colors

d.update_colors()

File “/anaconda/lib/python3.6/site-packages/bibliopixel/drivers/driver_base.py”, line 162, in update_colors

self._send_packet()

File “/anaconda/lib/python3.6/site-packages/bibliopixel/drivers/SimPixel/driver.py”, line 41, in _send_packet

self.server.update(pixels=self._buf)

AttributeError: ‘NoneType’ object has no attribute ‘update’

``

Thank you!

Vinesh