'-------------------Garage of Evil------------------------ ' HOW-TO Info for the Home Haunter ' http://www.garageofevil.com/ ' Real Time Two Button Control of Multiple Prop-1 Events ' {$STAMP BS1} ' {$PBASIC 1.0} ' ------------------------------------------------------variables SYMBOL counter_status = B1 SYMBOL cycles = B2 SYMBOL lid_delay = B3 ' ------------------------------ -----------------------constants SYMBOL event_selection = PIN6 SYMBOL action_button = PIN4 SYMBOL Serial = 7 Main: IF action_button = 1 THEN action 'no action called for - return and loop IF event_selection = 0 THEN main 'no events being selected? - return and loop counter_status = counter_status +1 'the event selection was pressed, add one to the counter SEROUT Serial, OT2400, ("!RC4", %10, "R", 2, 1) 'flash a light, use an output from the RC4 so I dont burn any 12V outputs PAUSE 100 DEBUG counter_status 'show how many times the event selector has been pressed SEROUT Serial, OT2400, ("!RC4", %10, "R", 2, 0) 'part of the light flash, in this line it turns it off PAUSE 100 'remove this pause with the debug commands - withouth it you couldnt see the last debug before i DEBUG CR ' clear the debug with the CR command - carriage return - GOTO main 'loop and keep counting action: counter_status = 0 DEBUG "action time" IF counter_status = 1 THEN Lightning_Crash IF counter_status = 2 THEN Fog_Machine IFcounter_status = 3 THEN Monster_Lid Lightning_Crash: SEROUT Serial, OT2400, (!"RC4!", %10, "R", 1, 1) PAUSE 250 SEROUT Serial, OT2400, (!"RC4!", %10, "R", 1, 0) SEROUT Serial, OT2400, ("!AP8", %00, "P", 1) GOTO Main Fog_Machine: SEROUT Serial, OT2400, (!"RC4!", %10, "R", 1, 1) PAUSE 2000 SEROUT Serial, OT2400, (!"RC4!", %10, "R", 1, 0) GOTO Main Monster_Lid: FOR cycles = 1 to 5 RANDOM lid_delay NEXT lid_delay= lid_delay // 200 + 100 cycles = 0 FOR cycles = 1 to 8 HIGH 1 PAUSE lid_delay LOW 1 NEXT GOTO Main