<s> import max7219 . led as led <EOL> import time <EOL> import random <EOL> from datetime import datetime <EOL> def date ( device , deviceId ) : <EOL> now = datetime . now ( ) <EOL> day = now . day <EOL> month = now . month <EOL> year = now . year - <NUM_LIT> <EOL> device . letter ( deviceId , <NUM_LIT:8> , int ( day / <NUM_LIT:10> ) ) <EOL> device . letter ( deviceId , <NUM_LIT:7> , day % <NUM_LIT:10> ) <EOL> device . letter ( deviceId , <NUM_LIT:6> , '<STR_LIT:->' ) <EOL> device . letter ( deviceId , <NUM_LIT:5> , int ( month / <NUM_LIT:10> ) ) <EOL> device . letter ( deviceId , <NUM_LIT:4> , month % <NUM_LIT:10> ) <EOL> device . letter ( deviceId , <NUM_LIT:3> , '<STR_LIT:->' ) <EOL> device . letter ( deviceId , <NUM_LIT:2> , int ( year / <NUM_LIT:10> ) ) <EOL> device . letter ( deviceId , <NUM_LIT:1> , year % <NUM_LIT:10> ) <EOL> def clock ( device , deviceId , seconds ) : <EOL> for _ in xrange ( seconds ) : <EOL> now = datetime . now ( ) <EOL> hour = now . hour <EOL> minute = now . minute <EOL> second = now . second <EOL> dot = second % <NUM_LIT:2> == <NUM_LIT:0> <EOL> device . letter ( deviceId , <NUM_LIT:4> , int ( hour / <NUM_LIT:10> ) ) <EOL> device . letter ( deviceId , <NUM_LIT:3> , hour % <NUM_LIT:10> , dot ) <EOL> device . letter ( deviceId , <NUM_LIT:2> , int ( minute / <NUM_LIT:10> ) ) <EOL> device . letter ( deviceId , <NUM_LIT:1> , minute % <NUM_LIT:10> ) <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> device = led . sevensegment ( cascaded = <NUM_LIT:3> ) <EOL> date ( device , <NUM_LIT:1> ) <EOL> clock ( device , <NUM_LIT:0> , seconds = <NUM_LIT:10> ) <EOL> for x in xrange ( <NUM_LIT:5> ) : <EOL> for intensity in xrange ( <NUM_LIT:16> ) : <EOL> device . brightness ( intensity ) <EOL> time . sleep ( <NUM_LIT:0.1> ) <EOL> device . brightness ( <NUM_LIT:7> ) <EOL> for x in xrange ( <NUM_LIT:2> ) : <EOL> for _ in xrange ( <NUM_LIT:8> ) : <EOL> device . scroll_right ( ) <EOL> time . sleep ( <NUM_LIT:0.1> ) <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> device . clear ( ) <EOL> for x in range ( - <NUM_LIT:30> , <NUM_LIT> ) : <EOL> device . write_number ( deviceId = <NUM_LIT:0> , value = x ) <EOL> time . sleep ( <NUM_LIT> ) <EOL> for x in range ( <NUM_LIT> , <NUM_LIT> ) : <EOL> device . write_number ( deviceId = <NUM_LIT:1> , value = x , base = <NUM_LIT:16> , leftJustify = True ) <EOL> time . sleep ( <NUM_LIT> ) <EOL> device . clear ( deviceId = <NUM_LIT:1> ) <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> device . clear ( ) <EOL> time . sleep ( <NUM_LIT:1> ) <EOL> a = random . randint ( - <NUM_LIT> , <NUM_LIT> ) <EOL> b = random . randint ( - <NUM_LIT> , <NUM_LIT> ) <EOL> device . brightness ( <NUM_LIT:3> ) <EOL> for x in range ( <NUM_LIT> ) : <EOL> a += random . random ( ) * <NUM_LIT:10> <EOL> b -= <NUM_LIT:1> <EOL> c = a + b / ( random . random ( ) * <NUM_LIT> ) <EOL> device . write_number ( deviceId = <NUM_LIT:0> , value = a , decimalPlaces = <NUM_LIT:1> ) <EOL> device . write_number ( deviceId = <NUM_LIT:1> , value = b , zeroPad = True ) <EOL> device . write_number ( deviceId = <NUM_LIT:2> , value = c , decimalPlaces = <NUM_LIT:2> ) <EOL> time . sleep ( <NUM_LIT:0.5> ) </s>
