Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

NAN values for SHM30 laser depth sensor


mwar Oct 26, 2020 03:01 PM

Hello. I am fairly new at programming with CRBasic. I've been able to figure out most things, but I can't get past NAN values being posted to the public table, even though I can see the data string on terminal emulator. Below is the SHM30 part of the program:

 

      SerialOpen (ComC5,9600,0,0,1000,0)
      SerialOut (ComC5,"srn","",1,10) 
      SerialOut (ComC5,"sf39.37","",1,10)'scale factor to convert meters to inches
      SerialOut (ComC5,"sp","",1,10) 'tilt angle offset
      SerialOut (ComC5,"of","",1,10) 'height offset
      SerialOut (ComC5,"xm","",1,10)
      Delay (0,100,mSec)
      SerialOut (ComC5,"xw","",1,10)
      Delay (0,100,mSec)
      SerialInRecord (ComC5,SHM30inputString,02,0,03,NBytesReturned,00)
      SplitStr (SHM30_data(),SHM30inputString,"",6,0)

    
      CallTable HourlySnowDepth
   NextScan

 The data string defined by the manual is [STX]eee.eeee sss.sss X TTT EE PP[CR][LF][ETX] with the unbracketed letters being values. The initial scan is set as Scan(1,Min,2,0). Note that there is another sensor in the program that is not shown here but works fine (I get numbers for data).

Just to re-state the problem: the data string is being sent from the sensor, but values shown in the public table show up as NAN.

Thanks for any help!


mwar Oct 26, 2020 04:29 PM

This post is under review.

Log in or register to post/reply in the forum.