;********Interactive Artwork ala Monster with two LDR eyes with a voltage divider***************** ;Change Code ;Change trigger_Sensativiy upwards to make less sensative to light changes ;Change the light Reading_Delay_Time downwards for capturing quicker motion ;Change START UP ROUTINE with a TUNE or Blink LED on pin0 ? ;Change the sound of LEFT and RIGHT Routines #no_data ;*************Create Symbols*************************************************** symbol light_Reading1 = b1 ;Takes first light reading symbol light_Reading2 = b2 ;Takes second light reading symbol trigger_Point_Left = b3 ; Is light reading2 MINUS the trigger sensativity symbol trigger_Point_Right = b4 ; Is light reading2 PLUS the trigger sensativity symbol trigger_Sensativity = b5 ; how far light change is above or below average before triggering output trigger_Sensativity = 7 ;Change trigger_Sensativity upwards to make less sensitive symbol Reading_Delay_time = 50 ; Change the pause time between light readings ;*********Start up Routine******************************************************** ;Put start up routine Here ;********Start Main loop********************************************************* main: readLDR: readadc 4, light_Reading1 ;First light reading pause Reading_Delay_time ;Delay time between readings in milliseconds readadc 4, light_Reading2 ;Second light Reading pause 20 TriggerPoints: trigger_Point_Right = light_Reading2 + trigger_Sensativity ;make trigger for Right, Set trigger sensativity at the Top of Code trigger_Point_Left = light_Reading2 - trigger_Sensativity ;make trigger point for Left ;debug Decide: ;Decide to go routine left or right or back to Main if light_Reading1 < trigger_Point_Left then gosub left if light_Reading1 > trigger_Point_Right then gosub right goto main ;***********End of Main Loop*********************************************** ;************Sounds when motion detected********************************* right: pulsout 0,40 tune 0,2,(0,2,4,6,7,9,11,16) ;Make your own Tune/sound/PWMOUT for right nap 4 return left: pulsout 0,40 tune 0,2,(16,11,9,7,6,4,2,0) ;Make your own Tune/sound/PWMOUT for left nap 4 return ;*************end of code*****************************************************