#!/usr/bin/env python # A clock! from LaserDisplay import * import math import random WIDTH = 255 HEIGHT = 255 LD = LaserDisplay() import time LD.set_scan_rate(30000) LD.set_blanking_delay(0) while True: t = time.localtime() hours = t.tm_hour%12 minutes = t.tm_min seconds = t.tm_sec # LD.set_color(RED) # LD.draw_text("%02i:%02i:%02i"%(hours,minutes,seconds), 220, 220, 20) LD.set_color(GREEN) angle = 2*PI*seconds/60 + PI/2 r = 2.0/3 * (WIDTH/2) LD.draw_line(WIDTH/2, HEIGHT/2, WIDTH/2 + r*math.cos(angle), HEIGHT/2 + r*math.sin(angle))
return gml TOTAL_TIME=float(sys.argv[2]) TIME_STRETCH = 1 ZOOM=1.0 DELTA = 1 DEGRADATION = 0.40 #DEGRADATION is the percentage of points that we ignore in order to render # faster in the laser display. Unfortunately we are not able to render too # complex content in our display without resulting in a lot of blinking. gml = readFile() LD = LaserDisplay({"server":"localhost","port": 50000}) #LD = LaserDisplay() LD.set_scan_rate(35000) LD.set_blanking_delay(0) LD.set_color(RED) t0=datetime.now() num_frame=0 while True: delta = datetime.now() - t0 t = delta.seconds + delta.microseconds/1000000.0 t = float(t)/TIME_STRETCH if t > TOTAL_TIME: t0=datetime.now() num_frame+=1 print num_frame, t
#!/usr/bin/env python # display ILDA animations from a given file from LaserDisplay import * import ILDA #LD = LaserDisplay() LD = LaserDisplay({"server": "localhost", "port": 50000}) LD.set_scan_rate(37000) LD.set_blanking_delay(0) WIDTH = 200 HEIGHT = 200 import sys import random ilda_file = open(sys.argv[1], 'rb') ilda_frames = ILDA.readFrames(ilda_file) frames = [] for f in ilda_frames: frame = [] for p in f.iterPoints(): frame.append( [WIDTH / 2 + (WIDTH / 2) * p.x, HEIGHT / 2 + (HEIGHT / 2) * p.y]) frames.append(frame) ilda_file.close() LD.set_color(YELLOW) for frame in frames: for _ in range(2):
pygame.draw.line(grid, GRIDCOLOR, (x*SIZE[0]/100,SIZE[1]/2-3), (x*SIZE[0]/100,SIZE[1]/2+3)) for y in range(80): pygame.draw.line(grid, GRIDCOLOR, (SIZE[0]/2 - 3, y*SIZE[1]/80), (SIZE[0]/2 + 3, y*SIZE[1]/80)) surface = pygame.Surface(screen.get_size()) x_old=0 y_old=0 for _ in range(1000): frames = wro.readframes(READ_LENGTH) display = LaserDisplay({"server":"localhost","port": 50000}) #display = LaserDisplay() display.set_scan_rate(45000) display.set_blanking_delay(0) display.set_color(WHITE) while True: try: clock.tick(FPS) for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() # for _ in range(30): # frames = wro.readframes(READ_LENGTH) frames = wro.readframes(READ_LENGTH) surface.fill(BGCOLOR)