You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
spydian/main.py

59 lines
1.5 KiB
Python

import pygame, time
from lib import graphiclib, hardwarelib, controllib
configuration = {
'GAS':5,
'STOP':2,
'MUSIC':1,
'LIGHT':0,
'VOLIN':5,
'VOLDE':4,
'REC':3
}
def main():
navigator = hardwarelib.Navigator(16)
7 years ago
print('navigator created')
light = hardwarelib.Light(15)
7 years ago
print('light created')
ultrasonic = hardwarelib.Ultrasonic(11,7)
7 years ago
print('ultrasonic created')
temperature = hardwarelib.Temperature()
7 years ago
print('temperature created')
camera = graphiclib.PiCamera((500, 0), (500, 1000))
7 years ago
print('camera created')
jstick = controllib.Joystick(navigator, light, configuration, camera)
7 years ago
print('joystic created')
#pygame stuff
screen = graphiclib.Screen(size=(1000,1000))
7 years ago
print('created screen')
all_sprites = pygame.sprite.RenderUpdates()
list = graphiclib.List((0,0),(500,1000))
all_sprites.add(list)
all_sprites.add(camera)
clock = pygame.time.Clock()
running = True
7 years ago
print('in running loop')
while running:
clock.tick(25)
for event in pygame.event.get():
if event.type == pygame.QUIT:
print('quit event')
running = False
dict = jstick.handle()
print('joystick handled')
list.set_dict(dict)
all_sprites.update()
print('updating sprites')
update_rects = all_sprites.draw(screen.screen)
print('drawing sprites')
screen.refresh(rectangles= update_rects)
print('refreshing screen')
pygame.quit()
if __name__ == '__main__':
main()