I have a nice Working PiGlow Script for my retropie but a little stuck


#1

I have a nice script butchered up, with smaller scripts none of which I wrote myself I’m a total hack but with retropie it go through a LED cycles then it loops the last part of the script once emulationstation loads (lucky timing?)

#!/usr/bin/env python
##################################################
## Switch each colour on in sequence on and off ##
##                                              ##
## Example by Jason - @Boeeerb                  ##
## hacked together by co4                       ##
##################################################

import time
import piglow

piglow.auto_update = True

for x in range(6):
    piglow.all(0)
    piglow.ring(x,80)
    time.sleep(0.25)

import piglow
import time

for x in range(18):
    piglow.led(x+1, 180)
    piglow.show()
    time.sleep(0.4)
    piglow.led(x+1, 0)
    piglow.show()
    time.sleep(0.4)

import piglow
import time

for x in range(18):
    piglow.led(x+1, 180)
    piglow.show()
    time.sleep(0.1)
    piglow.led(x+1, 0)
    piglow.show()
    time.sleep(0.1)

import piglow
import time

for x in range(18):
    piglow.led(x+1, 180)
    piglow.show()
    time.sleep(0.040)
    piglow.led(x+1, 0)
    piglow.show()
    time.sleep(0.040)

import piglow
from time import sleep

piglow.auto_update = True


val = 40
colour = 1

while True:
    if colour == 19:
        colour = 1
        if val == 40:
            val = 0
        else:
            val = 40

    piglow.led(colour, val)
    sleep(0.060)

    colour = colour + 1

it’s brilliant BUT I have 2 minor issues… when I reboot or shutdown my piglow remains on and lighten up, is there anyway to get the looping part of the script to reverse back up (red to white, then white to red) even if it’s not writing the script a general pointer where I can find out how to do it would be amazing Thanks :)