#!/usr/bin/env python32 #Date: 12th, March 2014 import RPi.GPIO as gpio import time gpio.setmode(gpio.BCM) gpio.setwarnings(False) iopins = [14, 15, 18, 17, 27, 22, 10, 9, 11] def light(t): # Set all pins as output for pin in iopins: gpio.setup(pin,gpio.OUT) if((t % 2) == 1): gpio.output(pin, gpio.HIGH) else: gpio.output(pin, gpio.LOW) t = t / 2 return t = 0.5 def binary_counter(): for j in range (0, 512 ): n = 1 m = 2 light((m * j) / m) time.sleep(t) gpio.cleanup() if __name__=='__main__': binary_counter()
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question