I have a problem with the comunication betwen the NRF24 and Neo 6m GPS, i am using 2 RF antennas and 1 Neo 6m GPS, it's All conected to arduino, i need to send information betwen the antennas, the information that is recibe from the Neo 6m Gps, the problem is that the antennas send information, but its not the info that i need, someone know what is happening?
Tengo un problema con la comunicacion entre el NRF24 y el Neo 6m GPS, estoy usando dos antenas de RF y 1 Neo 6m GPS, todo esta conectado a Arduino, necesito enviar la informacion de una antena a otra, esa informacion es la que recibe el Neo 6m GPS, el problema es que si envian informacion, pero no es la que ocupo, alguien me puede ayudar?
Transmisor
////////////GPS////////////////
#include <SoftwareSerial.h>
#include <TinyGPS++.h>
///////Antena RF//////////
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
//GPS
static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 9600;
//Objeto GPS
TinyGPSPlus gps;
//Coneccion serial
SoftwareSerial ss(RXPin, TXPin);
//
#define CE_PIN 9
#define CSN_PIN 10
//Canal a transmitir
byte direccion[5] ={'c','a','n','a','l'};
//Se crea radio con RF24
RF24 radio(CE_PIN, CSN_PIN);
float datos[2];
void setup() {
Serial.begin(9600);
ss.begin(GPSBaud);
radio.begin();
radio.openWritingPipe(direccion);
}
void loop() {
datos[0]=(gps.location.lat(),6);
datos[1]=(gps.location.lng(),6);
bool ok =radio.write(datos,sizeof(datos));
while (ss.available() > 0){
gps.encode(ss.read());
if(ok)
{
Serial.print("Datos enviados: ");
Serial.print(datos[0]);
Serial.print(" G° ");
Serial.print("Long: ");
Serial.print(datos[1]);
Serial.print(" G° ");
}
else{
Serial.println("no se ha podido enviar");
}
delay(1000);
}
Receiver
////////////GPS////////////////
#include <SoftwareSerial.h>
#include <TinyGPS++.h>
///////Antena RF//////////
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#define CE_PIN 9
#define CSN_PIN 10
byte direccion[5] ={'c','a','n','a','l'};
RF24 radio(CE_PIN, CSN_PIN);
float datos[2];
void setup() {
radio.begin();
Serial.begin(9600);
radio.openReadingPipe(1, direccion);
radio.startListening();
}
void loop() {
uint8_t numero_canal;
if ( radio.available() )
{
radio.read(datos,sizeof(datos));
Serial.print("Latitud: " );
Serial.print(datos[0]);
Serial.print(" G° ");
Serial.print("Longitud: " );
Serial.print(datos[1]);
Serial.print(" G° ");
}
else
{
Serial.println("No hay datos de radio disponibles");
}
delay(1000);
}