Wiki

Clone wiki

lightshowPi / Developer Tips

@broken2048
GPIO monitoring code for testing purposes

I've been using this for testing prior to hardware installation, audio/light sync, and testing modifications because my hardware is set up in a location other than the terminal into the Pi. ( I can't see the lightshow while tweaking parameters )

Not really an issue, but I wanted to share this little bit of code in the case it was needed by other developers. This would probably be of no concern to most users. hardware_controller.py :

def get_pins_values():
    pin_group = []
    for i in range(GPIOLEN):
        gpio_value = wiringpi.digitalRead(_GPIO_PINS[i])
        pin_group.append(gpio_value)

    return pin_group

lights_values.py : ( new file )

#!/usr/bin/env python

import time

import hardware_controller as hc

if __name__ == "__main__":

    while True:
        pinarr = hc.get_pins_values()
        print pinarr
        time.sleep(0.2)

Updated