The compass:
Model C100 (kvh.com)
RS 232 or 0 to +5V data in/out
Receives/Transmits ASCII
Message rate 10Hz
"d1" gets data once. Responds with > and data
$015.1,D,OK6BM
$015.1,D,OK6BM
$015.1,D,OK*6BM
It seems, the first time through the loop , d1 is not sent. The 2nd time something other than d1 is sent
and the 3rd and subsequent times are fine (with delay >73).
Is this normal (just a case of the software serial not being fast enough)?
It would be nice if I just asked for the data and was given it 1st time around or am I asking too much?
Would inserting more delay elsewhere help or would I be best to just have it spitting out data constantly and grab it when I need it?
Regards
Rob
It seems, the first time through the loop , d1 is not sent. The 2nd time something other than d1 is sent
and the 3rd and subsequent times are fine (with delay >73).
Is this normal (just a case of the software serial not being fast enough)?
adapt your code with a delay so the compass can startup.
(code not tested)
#include <NewSoftSerial.h>
NewSoftSerial compass(4, 5 , true);
void setup()
{
Serial.begin(19200);
compass.begin(9600);
delay(300); // give compass some time to start
}
void loop()
{
compass.println("d1");
delay(75);
while (compass.available() )
{
char c = compass.read();
if (c == '>') Serial.println(millis());
Serial.print(c);
}
}