SR50A Sonic Ranging Sensor
- 52 -
'Main Program
BeginProg
'Open RS232 port for communications 9600 BAUD is the default:
SerialOpen
(Com1,9600,0,0,2000)
Scan
(10,Sec,0,0)
'Measure the SR50A:
'Transmit serial command "p33<CR>"
SerialOut
(Com1,"p33"+chr(13),"",0,0)
'Flush the serial buffer
SerialFlush
(Com1)
'Recieve serial string from SR50A
SerialIn
(SR50AData,Com1,200,13,50)
SplitStr
(ParseVals,SR50AData,"",6,0)
'Subtract the corrected distance from the initial distance of the SR50A to the ground:
Snow_Depth=Initial_Distance
-
Dist_To_Snow
'Call Data Table and Store Data:
CallTable
(Table1)
NextScan
EndProg