This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

  • 0 voto(s) - 0 Media
  • 1
  • 2
  • 3
  • 4
  • 5
DUDA Envío de datos. Tarjeta feather 32u4
#1
Buenas, estoy usando un Adafruit Feather 32u4 y no encuentro la manera exacta de enviar datos de una placa a otra, concretamente los de el sensor BMP280 (Temperatura y Presión)

El codigo que tengo actualmente es este

Código:
#include <Wire.h>
#include <SPI.h>

#include <RH_RF69.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP280.h>


//Radio Parameters
#define NODEID        2    //unique for each node on same network
#define NETWORKID    100  //the same on all nodes that talk to each other
#define GATEWAYID    1    //Receiving node
#define ENCRYPTKEY    "cansateuskadi000" //exactly the same 16 characters/bytes on all nodes!
#define FREQUENCY RF69_433MHZ
#define IS_RFM69HCW true
#define SERIAL_BAUD 9600
#define RFM69_CS 8
#define RFM69_IRQ 7
#define RFM69_IRQN 4
#define RFM69_RST 4
#define DEST_ADDRESS 10
#define MY_ADDRESS 7

// Singleton instance of the radio driver
RH_RF69 rf69;


Adafruit_BMP280 bmp;


float TEMPERATURA;
float PRESION;



#if defined (__AVR_ATmega32U4__) // Feather 32u4 w/Radio
  #define RFM69_CS      8
  #define RFM69_INT    28
  #define RFM69_RST    4
  #define LED          13
#endif


void setup()
{
  //Initialize serial connection for debugging
  delay(5000);
  Serial.begin(9600);
  Serial.println("REBOOT");
  delay(5000);

  //BMP280

  Serial.begin(9600);     
  Serial.println("Iniciando:");   

  if ( !bmp.begin() ) {     
    Serial.println("BMP280 no encontrado !");
    while (1);       
  }
 

  //Initialize radio
  rf69.setTxPower(20, true);
  if (!rf69.init()) {
    Serial.println("RFM69 radio init failed");
    while (1);
  }
  Serial.println("RFM69 radio init OK!");
 
  // Defaults after init are 434.0MHz, modulation GFSK_Rb250Fd250, +13dbM (for low power module)
  // No encryption


  // If you are using a high power RF69 eg RFM69HW, you *must* set a Tx power with the
  // ishighpowermodule flag set like this:
  rf69.setTxPower(20, true);  // range from 14-20 for power, 2nd arg must be true for 69HCW

  // The encryption key has to be the same as the one in the server
  uint8_t key[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
                    0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
  rf69.setEncryptionKey(key);
}

void loop()
{

 
  TEMPERATURA = bmp.readTemperature(); 
  PRESION = bmp.readPressure()/100; 
 

  rf69.send((uint8_t *)radiopacket, strlen(radiopacket));
    rf69.waitPacketSent();

}


y el de la placa receptora este:
Código:
//Include the required libraries

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_BMP280.h>
#include <RH_RF69.h>
#include <RH_RF69.h>
#include <Adafruit_Sensor.h>


//Radio Parameters
#define NODEID        1    //unique for each node on same network
#define NETWORKID    100  //the same on all nodes that talk to each other
#define ENCRYPTKEY    "cansateuskadi000" //exactly the same 16 characters/bytes on all nodes!
#define FREQUENCY RF69_433MHZ
#define IS_RFM69HCW true
#define SERIAL_BAUD 9600

RH_RF69 rf69;

#if defined (__AVR_ATmega32U4__) // Feather 32u4 w/Radio
  #define RFM69_CS      8
  #define RFM69_INT    28
  #define RFM69_RST    4
  #define LED          13
#endif

void setup(){
 
  if (!rf69.init()) {
    Serial.println("RFM69 radio init failed");
    while (1);
  }
  Serial.println("RFM69 radio init OK!");
 
  // Defaults after init are 434.0MHz, modulation GFSK_Rb250Fd250, +13dbM (for low power module)
  // No encryption


  // If you are using a high power RF69 eg RFM69HW, you *must* set a Tx power with the
  // ishighpowermodule flag set like this:
  rf69.setTxPower(20, true);  // range from 14-20 for power, 2nd arg must be true for 69HCW

  // The encryption key has to be the same as the one in the server
  uint8_t key[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
                    0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
  rf69.setEncryptionKey(key);
 
}

void loop() {
if (rf69.available()) {
    // Should be a message for us now 
    uint8_t buf[RH_RF69_MAX_MESSAGE_LEN];
    uint8_t len = sizeof(buf);
    if (rf69.recv(buf, &len)) {
      if (!len) return;
      buf[len] = 0;
      Serial.print("Received [");
      Serial.print(len);
      Serial.print("]: ");
      Serial.println((char*)buf);
      Serial.print("RSSI: ");
      Serial.println(rf69.lastRssi(), DEC);

   
    }
  }
}
  Responder
#2
Buenos días

Has arreglado el problema de instalación de las librerías que te indique en la otra publicación?

No hace falta que abras un tema nuevo en varias zonas cada vez que tengas un problema, los mensajes se ven, lo que pasa es que hay poca gente dispuesta a ayudar, y todos trabajamos en otra cosa y se contesta cuando se puede.

Un saludo
  Responder
#3
(25-03-2022, 03:10 PM)asesorplaza1 escribió: Buenos días

Has arreglado el problema de instalación de las librerías que te indique en la otra publicación?

No hace falta que abras un tema nuevo en varias zonas cada vez que tengas un problema, los mensajes se ven, lo que pasa es que hay poca gente dispuesta a ayudar, y todos trabajamos en otra cosa y se contesta cuando se puede.

Un saludo

Si, las librerias están bien, lo que pasa es que no se exactamente como enviar los datos de una placa a otra.

Gracias!
  Responder
#4
Buenas noches.

Lo primero que tenemos que conseguir es que el programa compile, después ya veremos como arreglamos la comunicación.

De momento el programa "emisor", me da errores en la línea 64, 77, 93, y me hace referencia a errores de las librerías, no entiendo nada.

Si comparo tu programa con los ejemplos de RadioHead, no tienen nada que ver, es como si te hubieras comido parte de la configuración del RH_RF69

Por favor, pon el enlace a la pagina de donde copiaste el programa.

En el programa "receptor", incluyes dos veces la librería <RH_RF69.h>, líneas 6 y 7, quita una de ellas

En ninguno de los dos programas admite la línea

Código:
  rf69.setTxPower(20, true);  // range from 14-20 for power, 2nd arg must be true for 69HCW

Mañana me voy de viaje y no estaré operativo, el domingo le volveré a echar un vistazo a ver que encuentro.

Un saludo.
  Responder


Posibles temas similares…
Tema Autor Respuestas Vistas Último mensaje
  CONSULTA error al compilar exit status1 error al compilar tarjeta arduino uno nestordaniel 2 1,477 03-10-2022, 12:47 PM
Último mensaje: asesorplaza1
  Recuperar datos HDD CHA 6 2,610 07-05-2015, 08:29 AM
Último mensaje: battlestars3l4
  Problemas tarjeta de red Electromecánico 4 1,715 17-04-2015, 12:33 PM
Último mensaje: jumasape