#!/usr/bin/env python # -*- coding: utf-8 -*- # This program is copyright (c) 2016, P. Lutus and is released # under the GPL (http://www.gnu.org/licenses/gpl-3.0.en.html). import os, sys, re, time, signal import RPi.GPIO as G G.setmode(G.BCM) G.setwarnings(False) time_delay = 0.1 # seconds # map binary digits to I/O pins gpio_pins = tuple(range(2,27)) G.setup(gpio_pins,G.OUT) n = 0 mask = (2**len(gpio_pins))-1 try: while True: print('%3d = %08s' % (n,bin(n & mask)[2:])) for i in range(len(gpio_pins)): s = (2**i & n) != 0 G.output(gpio_pins[i],s) time.sleep(time_delay) n = (n+1) & 255 except: G.cleanup() print('So long for now.')