Posted by
Omkar Kamat
on
import sys, os import RPi.GPIO as GPIO import time import random #fpid = os.fork() #if fpid!=0: to_display = '12,25' GPIO.setmode (GPIO.BCM) GPIO.setwarnings(False) display_list = [17,27,22,10,9,11,6] # # display list ref: A, B, C, D, E, F, G for pin in display_list: GPIO.setup(pin,GPIO.OUT) # set pins for each segement # digits 1, 2, 3,4 set_digit = [26,8,19,7] #23=29 for digit in set_digit: GPIO.setup(digit,GPIO.OUT) # set pins for digit selector digit_dot = 16 # dot GPIO port GPIO.setup(digit_dot, GPIO.OUT) GPIO.setwarnings(True) # A, B, C, D,E,F,G arrSeg = [[0,0,0,0,0,0,1],\ [1,0,0,1,1,1,1],\ [0,0,1,0,0,1,0],\ [0,0,0,0,1,1,0],\ [1,0,0,1,1,0,0],\ [0,1,0,0,1,0,0],\ [0,1,0,0,0,0,0],\ [0,0,0,1,1,1,1],\ [0,0,0,0,0,0,0],\ [0,0,0,0,1,0,0]] def split_num(to_display): # splits the given number string """ Splits variable 'to_display' string to a list of elements, so that each element is a simple str number or space, and set strains to number of digits given &
- Get link
- X
- Other Apps