Nuts About Time Clock Program Control
home | videos | construction | control | lab book | team
return to flowcharts

Version 2 Cricket 1 Code

; John Galinato
; May 2002
; This cricket is dedicated to 
; timing 1 minute.


; Two signals (5 & 10) are sent 
; each minute to alternate the 
; nuthead action each minute.

; In addition a 0 is sent to
; clear the ir buffer

; it is important to minimize the 
; number of commands in this program
; because each command takes about
; 1.5/1000 of a second to execute
; (repeat 4000 [a, on] took 6 seconds.)
; "send" takes about .26 seconds
; (repeat 100 [send 5) took 26 seconds.)
; and this adds up over time.
; For example, if it takes 3 commands
; to time, send, and repeat
; the clock would
; lose 1.5/1000 + 260/1000 + 1.5/1000
; of a second every minute
; or 60 * 263/1000 of a second every
; hour (15 seconds per hour)
; or about 6 minutes every day!

; Two signals (5 & 10) are sent 
; each minute to alternate the 
; nuthead action each minute.

; In addition a 0 is sent to
; clear the ir buffer.

; To compensate for the execution time,
; the "wait 1 minute" command is
; adjusted from 600 tenths of a second
; to 594

; In a more accurate clock,
; the newir? and fastsend
; commands should be used

; Museum display power is turned
; off every night, and therefore
; the clock must be set by
; viewers every morning.

to clock-timer
;execute program when power is switched on
autostart-on
loop
[
; 260/1000 second to execute send
send 5
; 101.5/1000 second to wait for 
; send command to be received.
wait 1
; 260/1000 second to execute sand
send 0
; wait 1 minute less execution time
; 600-2.6-1.015-2.6=594
; Experimentation suggests that it 
; is loosing 1+ sec per min in
; addition to the 594 compensation.
; Recursion is changed to "loop" and 
; 594 => 584 => 582.
wait 582
send 10
wait 1
send 0
wait 581
]
end
stop



Build-It-Yourself, 426 Broadway, Cambridge, MA 02138 Tel: (617) 547-9705 Email