'{$STAMP BS2p} '*********************************************************** '**ÊÊÊÊ Commercial use of this software is prohibitedÊÊÊÊ ** '**ÊÊÊÊ Private and educational use only is permittedÊÊÊÊ ** '**ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ ** '**ÊÊÊÊÊÊÊ Written by Donald Bugden - November 2003ÊÊÊÊÊÊÊ** '**ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ ** '*********************************************************** EN CON 1 A0 CON 2 S0 CON 3 S1 CON 4 S2 CON 5 S3 CON 6 nLED CON 7 OUT CON 11 SCL CON 9 ' I2C clock SDA CON 8 ' I2C data NOP CON 0 ' No Operation command pRED CON 12 pGREEN CON 6 pBLUE CON 5 RX1 CON 0 TX1 CON 15 LCHAN CON 13 RED VAR Byte(3) GREEN VAR Byte(3) BLUE VAR Byte(3) status VAR Byte intro VAR Byte whichred VAR Byte intro = 1 volume VAR Byte pitch VAR Byte speed VAR Byte volume = 0 pitch = 5 speed = 3 Start: LOW A0 HIGH S0 HIGH S1 LOW nLED HIGH EN IF intro >= 1 THEN playintro playintro: intro = 0 GOSUB wait4shutup ' wait for last phrase to finish speaking I2COUT SDA, $c4, 0, [NOP,volume,pitch,speed,"i am here", 0] ' The above loads the modules internal buffer. You then need to send a command toÊ ' speak the phrase you just loaded. I2COUT SDA, $c4, 0, [$40] ' The speak command also flushes the buffer PAUSE 1000 GOSUB wait4shutup ' wait for last phrase to finish speaking I2COUT SDA, $c4, 0, [NOP,volume,pitch,speed,"to destroy", 0] ' The above loads the modules internal buffer. You then need to send a command toÊ ' speak the phrase you just loaded. I2COUT SDA, $c4, 0, [$40] ' The speak command also flushes the buffer Main: SEROUT TX1, 16429,[0, 5, 0] GOSUB Color DEBUG "R", DEC3 RED DEBUG " G", DEC3 GREEN DEBUG " B", DEC3 BLUE GOSUB CheckColor GOTO Main Color: LOW S2 LOW S3 COUNT OUT, pRED, RED HIGH S3 COUNT OUT, pBLUE, BLUE HIGH S2 COUNT OUT, pGREEN, GREEN RED = RED * 4 GREEN = GREEN * 4 DEBUG CLS RETURN CheckColor: IF red > blue AND red > green THEN CheckRed IF green > red AND green > blue THEN CheckGreen RETURN CheckRed: pitch = 4 GOSUB wait4shutup ' wait for last phrase to finish speaking IF RED > 20 AND RED < 30 THEN NoteRed1 IF RED > 30 AND RED < 40 THEN NoteRed2 IF RED > 40 AND RED < 50 THEN NoteRed3 IF RED > 50 AND RED < 60 THEN NoteRed4 IF RED > 60 AND RED < 70 THEN NoteRed5 IF RED > 70 AND RED < 80 THEN NoteRed6 IF RED > 80 AND RED < 90 THEN NoteRed7 IF RED > 90 AND RED < 100 THEN NoteRed8 IF RED > 100 AND RED < 110 THEN NoteRed9 IF RED > 110 THEN DivideRed RETURN DivideRed: RED = RED/2 RETURN CheckGreen: pitch = 6 GOSUB wait4shutup ' wait for last phrase to finish speaking IF GREEN > 20 AND GREEN < 30 THEN NoteGreen1 IF GREEN > 30 AND GREEN < 40 THEN NoteGreen2 IF GREEN > 40 AND GREEN < 50 THEN NoteGreen3 IF GREEN > 50 AND GREEN < 60 THEN NoteGreen4 IF GREEN > 60 AND GREEN < 70 THEN NoteGreen5 IF GREEN > 70 AND GREEN < 80 THEN NoteGreen6 IF GREEN > 80 AND GREEN < 90 THEN NoteGreen7 IF GREEN > 90 AND GREEN < 100 THEN NoteGreen8 IF GREEN > 100 AND GREEN < 110 THEN NoteGreen9 IF GREEN > 110 THEN DivideGreen RETURN DivideGreen: GREEN = GREEN/2 RETURN NoteRed1: I2COUT SDA, $c4, 0, [NOP,volume,pitch,speed,"i hate those green bastards", 0] ' The above loads the modules internal buffer. You then need to send a command toÊ ' speak the phrase you just loaded. I2COUT SDA, $c4, 0, [$40] ' The speak command also flushes the buffer FREQOUT LCHAN, 50*RED,RED/2,RED/4 RETURN NoteRed2: I2COUT SDA, $c4, 0, [NOP,volume,pitch,speed,"they can not be trusted", 0] ' The above loads the modules internal buffer. You then need to send a command toÊ ' speak the phrase you just loaded. I2COUT SDA, $c4, 0, [$40] ' The speak command also flushes the buffer FREQOUT LCHAN, 50*RED,RED/2,RED/4 RETURN NoteRed3: I2COUT SDA, $c4, 0, [NOP,volume,pitch,speed,"let me go i can take them", 0] ' The above loads the modules internal buffer. You then need to send a command toÊ ' speak the phrase you just loaded. I2COUT SDA, $c4, 0, [$40] ' The speak command also flushes the buffer FREQOUT LCHAN, 50*RED,RED/2,RED/4 RETURN NoteRed4: I2COUT SDA, $c4, 0, [NOP,volume,pitch,speed,"the green brains think they are so much smarter then us", 0] ' The above loads the modules internal buffer. You then need to send a command toÊ ' speak the phrase you just loaded. I2COUT SDA, $c4, 0, [$40] ' The speak command also flushes the buffer FREQOUT LCHAN, 50*RED,RED/2,RED/4 RETURN NoteRed5: I2COUT SDA, $c4, 0, [NOP,volume,pitch,speed,"i will not take that from them", 0] ' The above loads the modules internal buffer. You then need to send a command toÊ ' speak the phrase you just loaded. I2COUT SDA, $c4, 0, [$40] ' The speak command also flushes the buffer FREQOUT LCHAN, 50*RED,RED/2,RED/4 RETURN NoteRed6: I2COUT SDA, $c4, 0, [NOP,volume,pitch,speed,"you can trust us, we only want a little", 0] ' The above loads the modules internal buffer. You then need to send a command toÊ ' speak the phrase you just loaded. I2COUT SDA, $c4, 0, [$40] ' The speak command also flushes the buffer FREQOUT LCHAN, 50*RED,RED/2,RED/4 RETURN NoteRed7: I2COUT SDA, $c4, 0, [NOP,volume,pitch,speed,"they practice torture", 0] ' The above loads the modules internal buffer. You then need to send a command toÊ ' speak the phrase you just loaded. I2COUT SDA, $c4, 0, [$40] ' The speak command also flushes the buffer FREQOUT LCHAN, 50*RED,RED/2,RED/4 RETURN NoteRed8: I2COUT SDA, $c4, 0, [NOP,volume,pitch,speed,"we are stronger then them", 0] ' The above loads the modules internal buffer. You then need to send a command toÊ ' speak the phrase you just loaded. I2COUT SDA, $c4, 0, [$40] ' The speak command also flushes the buffer FREQOUT LCHAN, 50*RED,RED/2,RED/4 RETURN NoteRed9: I2COUT SDA, $c4, 0, [NOP,volume,pitch,speed,"will you join us", 0] ' The above loads the modules internal buffer. You then need to send a command toÊ ' speak the phrase you just loaded. I2COUT SDA, $c4, 0, [$40] ' The speak command also flushes the buffer FREQOUT LCHAN, 50*RED,RED/2,RED/4 RETURN NoteGreen1: I2COUT SDA, $c4, 0, [NOP,volume,pitch,speed,"do you really think they can be trusted", 0] ' The above loads the modules internal buffer. You then need to send a command toÊ ' speak the phrase you just loaded. I2COUT SDA, $c4, 0, [$40] ' The speak command also flushes the buffer FREQOUT LCHAN, 100*GREEN,GREEN,GREEN/3 RETURN NoteGreen2: I2COUT SDA, $c4, 0, [NOP,volume,pitch,speed,"red is the color of weakness", 0] ' The above loads the modules internal buffer. You then need to send a command toÊ ' speak the phrase you just loaded. I2COUT SDA, $c4, 0, [$40] ' The speak command also flushes the buffer FREQOUT LCHAN, 100*GREEN,GREEN,GREEN/3 RETURN NoteGreen3: I2COUT SDA, $c4, 0, [NOP,volume,pitch,speed,"they shouldn't be here anyway", 0] ' The above loads the modules internal buffer. You then need to send a command toÊ ' speak the phrase you just loaded. I2COUT SDA, $c4, 0, [$40] ' The speak command also flushes the buffer FREQOUT LCHAN, 100*GREEN,GREEN,GREEN/3 RETURN NoteGreen4: I2COUT SDA, $c4, 0, [NOP,volume,pitch,speed,"we green are so much smarter then the red", 0] ' The above loads the modules internal buffer. You then need to send a command toÊ ' speak the phrase you just loaded. I2COUT SDA, $c4, 0, [$40] ' The speak command also flushes the buffer FREQOUT LCHAN, 100*GREEN,GREEN,GREEN/3 RETURN NoteGreen5: I2COUT SDA, $c4, 0, [NOP,volume,pitch,speed,"i will kill them all", 0] ' The above loads the modules internal buffer. You then need to send a command toÊ ' speak the phrase you just loaded. I2COUT SDA, $c4, 0, [$40] ' The speak command also flushes the buffer FREQOUT LCHAN, 100*GREEN,GREEN,GREEN/3 RETURN NoteGreen6: I2COUT SDA, $c4, 0, [NOP,volume,pitch,speed,"i have been waiting here a long time", 0] ' The above loads the modules internal buffer. You then need to send a command toÊ ' speak the phrase you just loaded. I2COUT SDA, $c4, 0, [$40] ' The speak command also flushes the buffer FREQOUT LCHAN, 100*GREEN,GREEN,GREEN/3 RETURN NoteGreen7: I2COUT SDA, $c4, 0, [NOP,volume,pitch,speed,"they do not trust us", 0] ' The above loads the modules internal buffer. You then need to send a command toÊ ' speak the phrase you just loaded. I2COUT SDA, $c4, 0, [$40] ' The speak command also flushes the buffer FREQOUT LCHAN, 100*GREEN,GREEN,GREEN/3 RETURN NoteGreen8: I2COUT SDA, $c4, 0, [NOP,volume,pitch,speed,"i shall destroy them", 0] ' The above loads the modules internal buffer. You then need to send a command toÊ ' speak the phrase you just loaded. I2COUT SDA, $c4, 0, [$40] ' The speak command also flushes the buffer FREQOUT LCHAN, 100*GREEN,GREEN,GREEN/3 RETURN NoteGreen9: I2COUT SDA, $c4, 0, [NOP,volume,pitch,speed,"who gave them the right", 0] ' The above loads the modules internal buffer. You then need to send a command toÊ ' speak the phrase you just loaded. I2COUT SDA, $c4, 0, [$40] ' The speak command also flushes the buffer FREQOUT LCHAN, 100*GREEN,GREEN,GREEN/3 RETURN wait4shutup: I2CIN SDA, $c4, 0, [status] IF status>0 THEN wait4shutup RETURN END