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
CONSULTA 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:
[b]
Código:
[/b]
//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);

   
    }
  }
}[/font][/color]

[color=#666666][font=Open Sans, Arial, Tahoma, sans-serif]
  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