; Note: ; 01. 'C.3' is Pin 4, an Input Pin. ; 02. 'B.5' is Pin 8, an Analog Input Pin. ; 03. 'B.4' is Pin 9, an Analog Input Pin. ; 04. 'B.3' is Pin 10, an Analog Input Pin. ; 05. 'B.2' is Pin 11, an Analog Input Pin. ; 06. 'B.1' is Pin 12, an Output Pin. ; 07. HIGH = 5 Vdc. ; 08. LOW = 0 Vdc. #com 3 ; Specify Serial Port #picaxe 14M2 ; Specify uC #terminal off ; Disable Terminal Window symbol SND01 = w2 ; 'Sound 01' Seconds Value symbol DLY01 = w3 ; 'Delay 01' Seconds Value symbol SND02 = w4 ; 'Sound 02' Seconds Value symbol DLY02 = w5 ; 'Delay 02' Seconds Value dirsB = %00000010 ; Set B Port Pin B.1 as an Output dirsC = %00000000 ; Set C Port Pins as Inputs main: ; 'main' Function readadc B.2, b0 ; Measure 'Sound 01' Voltage readadc B.3, b1 ; Measure 'Delay 01' Voltage readadc B.4, b2 ; Measure 'Sound 02' Voltage readadc B.5, b3 ; Measure 'Delay 02' Voltage SND01 = b0 / 10 * 400 ; Convert 'snd01' Value to Seconds DLY01 = b1 / 8 * 64 ; Convert 'dly01' Value to Seconds SND02 = b2 / 10 * 400 ; Convert 'snd02' Value to Seconds DLY02 = b3 / 60 * 15000 ; Convert 'dly02' Value to Seconds if C.3 = 0 then whistle ; Check Pin C.3 for LOW goto main ; Return to beginning of 'main' Function whistle: ; 'whistle' Function high B.1 ; Set B.1 to HIGH pause SND01 ; Wait 'SND01' Seconds low B.1 ; Set B.1 to LOW pause DLY01 ; Wait 'DLY01' Seconds high B.1 ; Set B.1 to HIGH pause SND02 ; Wait 'SND02' Seconds low B.1 ; Set B.1 to LOW pause DLY02 ; Wait 'DLY02' Seconds goto main ; Return to 'main' Function