interactive experimental glass

This blog is a documentation of the "Interactive, Electronic and Experimental glass class held at Pilchcuk Glass School in Stanwood WA, from August 15- September 2

Monday, August 29, 2005

Monika's basic code for "breathing" LED's

' {$STAMP BS2sx}
' {$PBASIC 2.5}

' -----[ Declarations ]----------------------------------------------------

x VAR Word
y VAR Word

'ooh, breathing LED lights.
'thank you chuck. you rock.

allup:
DEBUG CR
HIGH 6
HIGH 7
HIGH 8
HIGH 9
HIGH 10
HIGH 11
HIGH 12
' PAUSE 2000
GOTO main


main:

DEBUG "This is accelerating"
DEBUG CR
FOR y= 15 TO 1 ' for each time (y) do this (flicker rate)
FOR x= 1 TO 15 ' stretches out flicker rate
HIGH 6
HIGH 7
HIGH 8
HIGH 9
HIGH 10
HIGH 11
HIGH 12
PAUSE 16-y ' keep it on for 16-y millisec
LOW 6
LOW 7
LOW 8
LOW 9
LOW 10
LOW 11
LOW 12
PAUSE y ' keep it off for the same # of millisec as round of loop (y)
NEXT ' do the loop again (y=y-1)
NEXT

HIGH 6
HIGH 7
HIGH 8
HIGH 9
HIGH 10
HIGH 11
HIGH 12
PAUSE 1000

DEBUG "This is decelerating"
DEBUG CR
FOR y= 1 TO 15 ' for each time (y) do this (flicker rate)
FOR x= 1 TO 12 ' stretches out flicker rate
'DEBUG "off"
LOW 6
LOW 7
LOW 8
LOW 9
LOW 10
LOW 11
LOW 12
PAUSE 2*(16-y) ' keep it on for 2*(16-y) millisec
' DEBUG "on"
HIGH 6
HIGH 7
HIGH 8
HIGH 9
HIGH 10
HIGH 11
HIGH 12
PAUSE y ' keep it off for the same # of millisec as round of loop (y)
NEXT ' do the loop again (y=y-1)
NEXT

FOR x= 1 TO 67 ' for each time (x) do this
LOW 6
LOW 7
LOW 8
LOW 9
LOW 10
LOW 11
LOW 12
PAUSE 10
HIGH 6
HIGH 7
HIGH 8
HIGH 9
HIGH 10
HIGH 11
HIGH 12 ' keep it off for the same # of millisec as round of loop(y)
PAUSE 10
NEXT
LOW 6
LOW 7
LOW 8
LOW 9
LOW 10
LOW 11
LOW 12
PAUSE 10

GOTO main

0 Comments:

Post a Comment

<< Home