Prop Maker 3WATT LED

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
dcaditz
 
Posts: 2
Joined: Tue Dec 21, 2021 1:40 am

Prop Maker 3WATT LED

Post by dcaditz »

The sample code for the Prop Maker 3 Watt LED (link below) does not seem to work. I get an error on the line r, g, b = colorwheel(i):

TypeError: 'int' object is not iterable

It seems that colorwheel just returns an integer

Using circuitpython 7.1.1 on an M4 Express

Any suggestions?


Sample code is here (scroll down to the 3 Watt LED example):
https://learn.adafruit.com/adafruit-pro ... cuitpython

User avatar
dastels
 
Posts: 15831
Joined: Tue Oct 20, 2015 3:22 pm

Re: Prop Maker 3WATT LED

Post by dastels »

Yes, colorwheel in rainbowio currently returns an int: 0xRRGGBB. You'll have to tear it apart to extract each byte:

Instead of

Code: Select all

r, g, b = colorwheel(i)
you can use

Code: Select all

c = colorwheel(i)
r = (c >> 16) & 0xFF
g = (c >> 8) & 0xfFF
b = c & 0xFF
Dave

User avatar
dcaditz
 
Posts: 2
Joined: Tue Dec 21, 2021 1:40 am

Re: Prop Maker 3WATT LED

Post by dcaditz »

Thank you. That explains it. I think there is a typo in the g line, though.

User avatar
dastels
 
Posts: 15831
Joined: Tue Oct 20, 2015 3:22 pm

Re: Prop Maker 3WATT LED

Post by dastels »

Ah, yes I didn't backspace over that lowercase f. Good catch.

Dave

Locked
Please be positive and constructive with your questions and comments.

Return to “Feather - Adafruit's lightweight platform”