Post a new topicPost a reply Page 1 of 1   [ 5 posts ]
Author Message
 Post subject: GPS no funciona en MEGA
PostPosted: Sun Dec 19, 2010 2:30 pm 

Joined: Sun Dec 19, 2010 2:26 pm
Posts: 27
Buenas, tengo la placa Mega, a la cual he comprado su shield GPS, la conecto y programandolo como ustedes dicen, no funciona. No me envía nada, ni responde a las ordenes de sentencias.

Asombrosamente, me envia información al dejar pulsado el botón del reset,pero de nuevo me envia todas las sentencias haciendo caso omiso a lo que le digo.

Entonces lo que hice fue crear un código cuasivacio, es decir , unicamente le puse el setup() y el loop() , sin nada mas, todo en blanco y entonces si que me enviaba sin necesidad de pulsar el reset de la placa, pero de nuevo no responde a las sentencias.

Me gustaría saber qué debo de hacer, o si es por la placa Mega.

Muchas gracias, cualquier aporte será bienvenido.


Top
 Profile  
 
 Post subject: Re: GPS no funciona en MEGA
PostPosted: Mon Dec 20, 2010 8:41 am 

Joined: Mon Sep 28, 2009 11:06 am
Posts: 2042
Hola alanfaster,

Ten en cuenta que con Arduino Mega, como no se puede quitar el microcontrolador y por lo tanto no puedes conectar el GPS en modo gateway.

¿Tienes un Arduino USB (duemilanove - UNO...) para hacer la prueba en modo gateway?

De todas formas en Arduino Mega tiene que funcionar.
Lo mejor es que pegues aquí el código que usas.

Un saludo


Top
 Profile  
 
 Post subject: Re: GPS no funciona en MEGA
PostPosted: Thu Dec 23, 2010 4:11 pm 

Joined: Sun Dec 19, 2010 2:26 pm
Posts: 27
Buenas ! Perdonar el retraso, tengo el Arduino Mega 2560.
No tengo ninguno de los otros, pero me resulta extraño que no funcione.
También he probado a cambiar el rx y tx por 0 y 1, ya que se pincha en la shield en dichos pins, y tampoco va.

Cuando me refiero a que no me va, es que no responde a las ordenes y a que únicamente manda cuando dejo pulsado el reset del Mega.

La única manera que me envie solo sin tener que pulsar el reset, es escribiendo el siguiente código:

void setup(){
}
void loop(){
}
Pero creo que ahi no tiene sentido ya que digo yo que para algo se necesitará el código que utilizais en el tutorial.




El código que utilizo, es el que poneis en el tutorial( el que no me funciona mas que con el reset):


/*
* Copyright (C) 2010 Libelium Comunicaciones Distribuidas S.L.
* http://www.libelium.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Version 0.1
* Author: Marcos Yarza
*/

// include the SoftwareSerial library
#include <SoftwareSerial.h>

// Constants
#define rxPin 9 //rx pin in gps connection
#define txPin 8 //tx pin in gps connection

// set up the serial port

SoftwareSerial gps = SoftwareSerial(rxPin, txPin);

// variables
byte byteGPS = 0;
int i = 0;
int h = 0;

// Buffers for data input
char inBuffer[300] = "";
char GPS_RMC[100]="";
char GPS_GGA[100]="";

void setup(){

//setup for mySerial port
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
gps.begin(4800);

//setup for Serial port
Serial.begin(19200);

delay(1000);
}

void loop(){

// Read the RMC sentence from GPS
byteGPS = 0;
byteGPS = gps.read();
while(byteGPS != 'R'){
byteGPS = gps.read();
}
GPS_RMC[0]='$';
GPS_RMC[1]='G';
GPS_RMC[2]='P';
GPS_RMC[3]='R';

i = 4;
while(byteGPS != '*'){
byteGPS = gps.read();
inBuffer[i]=byteGPS;
GPS_RMC[i]=byteGPS;
i++;
}

// Read GGA sentence from GPS
byteGPS = 0;
byteGPS = gps.read();
while(byteGPS != 'A'){
byteGPS = gps.read();
}
GPS_GGA[0]='$';
GPS_GGA[1]='G';
GPS_GGA[2]='P';
GPS_GGA[3]='G';
GPS_GGA[4]='G';
GPS_GGA[5]='A';

i = 6;
while(byteGPS != '*'){
byteGPS = gps.read();
inBuffer[i]=byteGPS;
GPS_GGA[i]=byteGPS;
i++;
}

// print the GGA sentence to USB
Serial.print("GGA sentence: ");
h = 0;
while(GPS_GGA[h] != 42){
Serial.print(GPS_GGA[h],BYTE);
h++;
}
Serial.println();

// print the RMC sentence to USB
Serial.print("RMC sentence: ");
h = 0;
while(GPS_RMC[h] != 42){
Serial.print(GPS_RMC[h],BYTE);
h++;
}
Serial.println();
}

Gracias


Top
 Profile  
 
 Post subject: Re: GPS no funciona en MEGA
PostPosted: Thu Dec 23, 2010 6:12 pm 

Joined: Sun Dec 19, 2010 2:26 pm
Posts: 27
Tiene algo que ver ésto que he leido acerca de ciertos pins?

http://www.arduino.cc/cgi-bin/yabb2/YaB ... 1287382108


Top
 Profile  
 
 Post subject: Re: GPS no funciona en MEGA
PostPosted: Wed Dec 29, 2010 6:25 pm 

Joined: Sun Dec 19, 2010 2:26 pm
Posts: 27
Solucionado


Top
 Profile  
 
Display posts from previous:  Sort by  
Post a new topicPost a reply Page 1 of 1   [ 5 posts ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:


Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Libelium theme based on 610nm Style by Daniel St. Jules of http://www.gamexe.net


© Libelium Comunicaciones Distribuidas S.L. | Terms of use