Build-Your-Own-Door-Alarm + Movement PING-servo
Hello,
I would like to add an istruction in this program "Build-Your-Own-Door-Alarm"
The istruction that I want to add is to rotate(45° -45° ) the PING sensor in order to "view" all the object, but I don't know how can I do
I would like to add an istruction in this program "Build-Your-Own-Door-Alarm"
The istruction that I want to add is to rotate(45° -45° ) the PING sensor in order to "view" all the object, but I don't know how can I do


Comments
' {$STAMP BS2} ' {$PBASIC 2.5} ' -----[ Title ]----------------------------------------------------------- ' DoorAlarm.bs2 ' Monitors a doorway until an object is in the way, then an alarm sounds, ' and the number of triggers are recorded and displayed to the LCD. ' -----[ Variables ]------------------------------------------------------- time VAR Word ' Round trip echo time intruderCnt VAR Byte ' Count of alarm triggers counter VAR Word ' Counter for FOR...NEXT loop ' -----[ Constants ]------------------------------------------------------- maxDist CON 2000 ' Maximum distance for alarm trigger ' -----[ Jolly Roger Custom Characters ]----------------------------------- SEROUT 12, 84, [248, %00000, %11000, %11000, %01100, ' Top left %01110, %11011, %11001, %00000] ' crossbone SEROUT 12, 84, [249, %00000, %11001, %11011, %01110, ' Bottom left %01100, %11000, %11000, %00000] ' crossbone SEROUT 12, 84, [250, %00000, %01110, %11111, %11111, ' Top half %10101, %10101, %11111, %01110] ' of skull SEROUT 12, 84, [251, %01110, %11111, %11111, %10001, ' Bottom half %10001, %11111, %01110, %00000] ' of skull SEROUT 12, 84, [252, %00000, %00011, %00011, %00110, ' Top right %01110, %11011, %10011, %00000] ' crossbone SEROUT 12, 84, [253, %00000, %10011, %11011, %01110, ' Bottom right %00110, %00011, %00011, %00000] ' crossbone ' -----[ Initialization ]-------------------------------------------------- SEROUT 12, 84, [22,12] ' Initialize LCD PAUSE 5 intruderCnt = 0 ' Reset intruder count to 0 ' -----[ Main Routine ]---------------------------------------------------- DO PULSOUT 15, 5 ' Send pulse PULSIN 15, 1, time ' Read echo time IF (time < maxDist) THEN ' If alarm is triggered... intruderCnt = intruderCnt + 1 SEROUT 12, 84, [128, 0, 129, 2, 130, 4, ' Display Jolly Roger 148, 1, 149, 3, 150, 5] SEROUT 12, 84, [132, DEC intruderCnt, ' Display number of alarm " intruders "] ' triggers on the LCD SEROUT 12, 84, [153, "detected!! "] FOR counter = 0 TO 3 FREQOUT 4, 500, 3800 ' Play alarm tone PAUSE 100 HIGH 1 ' Flash LEDs HIGH 5 FREQOUT 4, 500, 2700 ' Play lower tone for variety PAUSE 100 LOW 1 ' Flash LEDs LOW 5 NEXT ELSEIF (intruderCnt = 0) THEN SEROUT 12, 84, [128, 0, 129, 2, 130, 4, ' Display Jolly Roger 148, 1, 149, 3, 150, 5] SEROUT 12, 84, [133, "Alarm", 153, "Armed!"] SEROUT 12, 84, [141, 0, 142, 2, 143, 4, ' Display Jolly Roger 161, 1, 162, 3, 163, 5] ENDIF PAUSE 100 LOOPhttp://www.parallax.com/downloads/roaming-ping-advanced-basic-stamp-code
"http://www.parallax.com/downloads/roaming-ping-advanced-basic-stamp-code"