Hello, I am new in Arduino need some suggestions, I am trying to receive NMEA from the fish finder speed and depth,
and control a DC motor forward and reverse to reel.
I had managed to get the NMEA data from the NMEA simulator with some example codes.
but stuck on the parsing issue.
#include <SoftwareSerial.h>
#include <Wire.h>
#include <NMEA0183.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
// matches Zihatec RS422/RS485 shield
SoftwareSerial gps(2, 3);
NMEA0183 nmea;
void setup()
{
// Start Serial
while (!Serial);
Serial.begin(4800);
gps.begin(4800);
Serial.println("NMEA0183 parser test");
// Start LCD
lcd.begin();
lcd.backlight();
}
void loop()
// Reveive data from GPS
{
if (gps.available())
{
char c = gps.read();
if (nmea.update(c))
{
Serial.print("NMEA0183 sentence accepted (");
Serial.print(nmea.getFields());
Serial.print(" fields): ");
Serial.write(nmea.getSentence());
Serial.println();
// Display Data from GPS
lcd.clear();//Clean the screen
lcd.setCursor(0,0);
lcd.print(nmea.getFields());
lcd.setCursor(3,0);
lcd.print(" data received ");
lcd.setCursor(0,1);
lcd.print(nmea.getSentence());
// Receive data from load cell - to understand the max load on the line
// Receive data from AMPmeter - to understand the dc load
// Receive data from Rotation meter to calculate the revolutions of the reel
// Send and Receive commands from Bluetooth
}
}
}
I need some suggestions and help on parsing the following two sentences in the loop
From $SDDBS 3rd 12,4 meters depth
From $GPRMC 6th 6 knots of speed
Serial monitor output:
NMEA0183 sentence accepted (6 fields): $SDDBS,40.7,f,12.4,M,6.8,F*0B
NMEA0183 sentence accepted (12 fields): $GPRMC,120300.087,A,3456.14,S,13832.68,E,6.0,43.9,300920,,,*09