Go Down

Topic: correction for a beginner - NMEA MULTIPLEXEUR - FRENCH (Read 85 times) previous topic - next topic


Jul 13, 2016, 06:55 pm Last Edit: Jul 13, 2016, 08:34 pm by Akshobya23

I am trying to use a old arduino program but it is not working...( i am beginner)

It is a nmea sentence reader i try to send on a http page, i managed to connect the ethernet card with a ip adress and i manage to ping it its ok,

I manage to read the nmea sentence on the arduino monitor,

So i think is about the program was writed for a old ethernet shield and not a ethernet shiel 2 so i tryed to correct it

her is the program ::

Code: [Select]

//  AIS + GPS + autres entrées + Ethernet
// utilisation librairie  NMEA_ACQ

#include <nmea_acq.h>//librairie nmea_acq
#define nmea_gps Serial3
#define nmea_ais Serial2
#define nmea_1 Serial1 // autre entree
//Serial  ne peut être utilisé si le PC est connecté
#include <SPI.h>
#include <Ethernet2.h>

 // (ethernet hardware) addresses  de la carte (mac et IP):
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 56, 177 };  
byte subnet[] = { 255, 255, 255, 0 };
EthernetServer server(80);

ACQ rec_ais(ALL);// librairie pour AIS
ACQ rec_gps(ALL);
ACQ rec_nmea1(ALL);

void setup()
// initialialise la carte ethernet
Ethernet.begin(mac, ip, subnet); // start ethernet using the mac and IP address
// Setup serial connexion vers PC.
Serial.println("NMEA Multiplexer... GPS + AIS + Autres");

   // Setup serial connexion NMEA
nmea_1.begin(4800); // autre entree
delay(1000); // donne a la carte  ethernet une  seconde pour s' initialiser


void loop()
char car = 0; //variable contenant le caractère à lire GPS

   // il y a un caractere à lire ?
if (nmea_gps.available())
{car = nmea_gps.read(); // lect caractere
// utilisation de la librairie NMEA_ACQ pour lire la sentence GPS
if (rec_gps.lecture(car)==1)// valeur de retour TRUE:1
{// recuperation de la phrase nmea


if (nmea_ais.available())//
{car = nmea_ais.read(); // lect caractere
// utilisation de la librairie NMEA_ACQ pour lire la sentence AIS
if (rec_ais.lecture(car)==1)// valeur retour TRUE:1
{// recuperation de la phrase


if (nmea_1.available())//
{car = nmea_1.read(); // lect caractere
// utilisation de la librairie NMEA_ACQ pour lire la sentence
if (rec_nmea1.lecture(car))
{// recuperation de la phrase

EthernetClient client = server.available();
if (client) {
boolean current_line_is_blank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
// if we've gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so we can send a reply
if (c == 'n' && current_line_is_blank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
// phrases NMEA à envoyer
if (c == ' ') {
// we're starting a new line
current_line_is_blank = true;
} else if (c != ' ') {
// we've gotten a character on the current line
current_line_is_blank = false;
// give the web browser time to receive the data

and here is the link of the things


if someone can help me, that would be great !!!




The code you have posted (and keep f**king with) does something. You haven't bothered to explain what it does.

You haven't bothered to explain how that differs from what you want.


OP double posted in French forum

I provided some exploration note there

For example

if (c == 'n' && current_line_is_blank) {

Should definitely read '\n' not 'n' and '\r' is not handled.
Please do not PM me for help,  others will benefit as well if you post your question publicly on the forums

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131