Hardware Reference
In-Depth Information
pygame.display.update()
#end of main loop
# Function definitions
# read two encoder with alternating 00 11 detent
def readEncoders() : #exit when one has moved
global current_reading, lastPort
moved = False
inc = 8
while not moved :
checkForQuit()
port = pfio.read_input()
portP = (port & 0xc0) >> 6
lastPortP = (lastPort & 0xc0) >> 6
for axis in range(0,2) :
if lastPortP != portP and (lastPortP == 0 or ;
lastPortP == 0x3) :
if (lastPortP == 0 and portP == 0x2) or ;
(lastPortP == 0x3 and portP == 0x1):
current_reading[axis] -= inc
moved = True
if (lastPortP == 0x3 and portP == 0x2) or ;
(lastPortP == 0 and portP == 0x1):
current_reading[axis] += inc
moved = True
portP = (port & 0x30) >> 4
lastPortP = (lastPort &0x30) >> 4
if port &0x8 :
blank_screen()
lastPort = port
def blank_screen():
screen.fill(background) # blank screen
pygame.display.update()
def terminate():
print “Closing down please wait”
pfio.deinit()
pygame.quit()
continued
Search WWH ::




Custom Search