CheerBorg
Forums:
Hello,
I have the LEDBorg setup with the CheerLights project with the python script from https://www.piborg.org/cheerborg. I think it would be cool if I have a line of five or six pumpkins but I really don't want them all to show the same color. Is there anyway to edit this script to pull the 2nd, 3rd, 4th, and 5th from latest color? I would put the pumpkins in order so when the color changes the right most pumpkin will change to the latest color, and the 2nd to last color on the second pumpkin and so on. Any info would be appreciated. Have a great day everyone!!!
piborg
Wed, 09/06/2017 - 11:55
Permalink
Reading older colours from CheerLights
Yes there is, it is actually fairly simple to change the script to get previous colours :)
First you need to change where the script looks for the colour. Find this line:
and change it for this one:
This will now grab a list of the colours which have been set instead of just the last colour name.
Next change the line which reads the data from
to
as it is more than just a single colour name.
The values held in
colourData
will look something like this:The last thing to do is pick out the colour we want. Add these lines just before the
if
line:The first line of code takes the
colourData
value and gets a single line of text from it. The headings are line 0, the last colour set is line 1, the previous colour is line 2 and so on. Change the1
for a larger value to get an older colour selection :)The second line of code takes the chosen line of text and grabs the third column, the
field1
value. This contains the same names the script already uses. It then puts this value intocolourName
, which is where the rest of the script expects to find it.That should be all you need to get any number of colours you like. You can repeat the last two lines added to grab several colour names in the same script as well. For example:
would grab the last colour and the previous colour names as
colourName1
andcolourName2
respectively.