rem button_control.bas uses the Blassic interpreter rem and is sent variables $string $name $timedate rem from the ash script pg-beeper1.sh that is called by beeper1.cgi rem that sets up the web page seen by the remote user. rem The top part of the web page is from beeper1.html rem Sunspot 2007 - www.sunspot.co.uk If programarg$(2) = "A" Then sender$ = "xxx" If programarg$(2) = "S" Then sender$ = "yyyy" If programarg$(2) = "D" Then sender$ = "zzzz" rem tell the sender what they actually sent and Sweex time print "",sender$," just sent this message
" print "", programarg$(1), "
" print "",programarg$(3),"
" rem read the buttons - display if pressed - beep if not pressed - 10 times over rem (a button press trips a flip-flop that lights an led - the Sweex reads the flip-flop state) For j = 1 to 10 rem read the button led states open "/dev/gpio11" as #1 input #1,gpio11$ close #1 open "/dev/gpio14" as #2 input #2,gpio14$ close #1 open "/dev/gpio17" as #1 input #1,gpio17$ close #1 IF gpio11$ = "0" Then goto report_left_button IF gpio14$ = "0" Then goto report_middle_button IF gpio17$ = "0" Then goto report_right_button IF gpio11$ = "1" AND gpio14$ = "1" AND gpio17$ = "1" Then print " No response yet, beeping again in 5 seconds, try ",j," of 10
" rem - no response so ring the bell again! if programarg$(2) = "A" Then GOSUB A if programarg$(2) = "S" Then GOSUB S if programarg$(2) = "D" Then GOSUB D PAUSE 5000 : rem do it again in 5 seconds next j system LABEL report_left_button print "OK!



" system LABEL report_middle_button print "Sorry - I am busy



" system LABEL report_right_button print "I will do that in 10 minutes



" system LABEL A rem send a police siren shell "pulse_burst 0 4000 4000 350" shell "pulse_burst 0 5000 5000 300" shell "pulse_burst 0 4000 4000 350" shell "pulse_burst 0 5000 5000 300" shell "pulse_burst 0 4000 4000 350" shell "pulse_burst 0 5000 5000 300" shell "pulse_burst 0 4000 4000 350" shell "pulse_burst 0 5000 5000 300" shell "pulse_burst 0 4000 4000 350" shell "pulse_burst 0 5000 5000 300" shell "pulse_burst 0 4000 4000 350" shell "pulse_burst 0 5000 5000 300" RETURN LABEL S rem send a down chirp for i = 1 to 2 shell "pulse_burst 0 3400 3400 100" shell "pulse_burst 0 3500 3500 100" shell "pulse_burst 0 3600 3600 100" shell "pulse_burst 0 3700 3700 100" shell "pulse_burst 0 3800 3800 100" shell "pulse_burst 0 3900 3900 100" shell "pulse_burst 0 4000 4000 100" shell "pulse_burst 0 4100 4100 100" shell "pulse_burst 0 4200 4200 100" shell "pulse_burst 0 4300 4300 100" shell "pulse_burst 0 4400 4400 100" shell "pulse_burst 0 4500 4500 100" shell "pulse_burst 0 4600 4600 100" shell "pulse_burst 0 4700 4700 100" shell "pulse_burst 0 4800 4800 100" shell "pulse_burst 0 4900 4900 100" shell "pulse_burst 0 5000 5000 100" next i RETURN LABEL D rem send Beethovens 5th for i = 1 to 2 shell "pulse_burst 0 4242 4242 160" PAUSE 40 shell "pulse_burst 0 4242 4242 160" PAUSE 40 shell "pulse_burst 0 4242 4242 160" PAUSE 40 shell "pulse_burst 0 5100 5100 1000 next i RETURN