Hello all,
I am having trouble reading distance values from my sr50at ultrasonic sensors. The temperature probe on the Sr50at updates properly however the distance values most of the time remain at zero. I have posted my code below: Thanks!
Public PTemp, batt_volt
Public SR50ADistanceToGround = 3.0
Public SR50AReturnValues(3) As Float
Alias SR50AReturnValues(1) = SR50A_SnowDepth_Meters
Alias SR50AReturnValues(2) = SR50A_QualityVal
Alias SR50AReturnValues(3) = SR50A_AirTempC
'Define Data Tables
DataTable (Test,1,-1)
DataInterval (0,60,Sec,10)
Minimum(1,batt_volt,FP2,0,False)
Sample (1,PTemp,FP2)
Sample (1,SR50A_SnowDepth_Meters,IEEE4)
Sample (1,SR50A_QualityVal,FP2)
Sample (1,SR50A_AirTempC,IEEE4)
EndTable
'Main Program
BeginProg
Scan (60,Sec,0,0)
PanelTemp (PTemp,250)
Battery (batt_volt)
SDI12Recorder (SR50AReturnValues,1,0,"M3!",1.0,0)
'Call Output Tables
CallTable Test
NextScan
EndProg
I have not used the SR50 but in looking at the manual, it appears that your "M3!" command returns "distance-meters". The "M4!" command returns "snow depth meters". I think you are looking for the "M4!" command.
* Last updated by: thommark on 6/1/2015 @ 10:30 AM *
Sorry for the confusion, I had just based this program off of an example program in the manual (and forgot to change variable names!), I am just going for a simple distance measurement.