Duda de dispositivo XL1278-SMT a Arduino

Hola, tengo una duda sobre como programar el modulo XL1278-SMT al arduino, lo he probado estos dos juntos, (Transmisor y receptor) y me anda bien, comparten datos y todo, eso si con un sensor de humedad análogo DHT2301. Pero ahora quiero conectarle un sensor digital y nose como modificarlo para adaptarlo a este. Les dejo el código del transmisor, quien es el que debe poseer el sensor en su IDE.

Gracias.

Este es el código que posee el sensor DHT2301 (Análogo), que me gustaría sacarlo y adaptarlo a uno digital.

///
///                 Arduino      SX1278_Lora
///                 GND----------GND   (ground in)
///                 3V3----------3.3V  (3.3V in)
/// interrupt 0 pin D2-----------DIO0  (interrupt request out)
///          SS pin D10----------NSS   (CS chip select in)
///         SCK pin D13----------SCK   (SPI clock in)
///        MOSI pin D11----------MOSI  (SPI Data in)
///        MISO pin D12----------MISO  (SPI Data out)
///


#include <SPI.h>
#include <RH_RF95.h>
#define DHT11_PIN 0
char sensor_string[]="Humidity: 00 Temperature: 00";
// Singleton instance of the radio driver
RH_RF95 SX1278;

byte read_dht11_dat()
{
byte i = 0;
byte result = 0;
for(i=0;i<8;i++)
{
while(!(PINC&_BV(DHT11_PIN)));
delayMicroseconds(30);
if(PINC&_BV(DHT11_PIN))
result|=(1<<(7-i));
while((PINC&_BV(DHT11_PIN)));
}
return result;
}

void setup()
{
 DDRC|=_BV(DHT11_PIN);
  PORTC|=_BV(DHT11_PIN);
    Serial.begin(9600);
    while (!Serial) ; // Wait for serial port to be available
   
    if (!SX1278.init())
        Serial.println("Notice:init failed");
    
    // Defaults init are 434.0MHz, 13dBm, Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on
}

void loop()
{
byte dht11_dat[5];
byte dht11_in;
char humstring[3];
char tmpstring[3];
//String humidi;
//String temper;
byte i;
PORTC &= ~_BV(DHT11_PIN);
delay(18);
PORTC|=_BV(DHT11_PIN);
delayMicroseconds(40);
DDRC &= ~_BV(DHT11_PIN);
delayMicroseconds(40);
dht11_in = PINC & _BV(DHT11_PIN);
delayMicroseconds(80);
dht11_in=PINC & _BV(DHT11_PIN);
delayMicroseconds(80);
int x=0;
for(x=0;x<5;x++)
dht11_dat[x]=read_dht11_dat();
DDRC|=_BV(DHT11_PIN);
PORTC|=_BV(DHT11_PIN);
byte dht11_check_sum = dht11_dat[0]+dht11_dat[1]+dht11_dat[2]+dht11_dat[3];
if(dht11_dat[4]!=dht11_check_sum)
{
Serial.println("DHT11 checksum error");
}
itoa(dht11_dat[0], humstring, 10); 
itoa(dht11_dat[2], tmpstring, 10);
sensor_string[10] = humstring[0];
sensor_string[11] = humstring[1];
sensor_string[26] = tmpstring[0];
sensor_string[27] = tmpstring[1];
Serial.println("Sending to SX1278_server");
Serial.println(sensor_string);
// Send a message to SX1278_server
SX1278.send(sensor_string, sizeof(sensor_string));
Serial.println("mark0");
SX1278.waitPacketSent();
Serial.println("mark1");
// Now wait for a reply
uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);
delay(1000);
Serial.println("mark2");
}

Y ese código lo hiciste tu o lo copiaste?

Busca arduino DTH2301 y seguramente encontrarás una librería que lo maneje.
Luego con la librería solo debes adaptarlo.

El DHT2301 es mas bien conocido como AM2301
Esta es la librería de ADAFRUIT para los sensores DHT de todo tipo, corre el DHT_Tester.ino y prueba si funciona.

Revisa como conectarlo. Hay versiones con y sin resistencia al pin de datos.

Si, todo bien con el sensor DHT2301, lo he probado con ambos (Transmisor y receptor), y se comunican perfectamente, enviando la humedad correspondiente. Pero mi duda va, si yo quiero sacar el DHT2301(Análogo) y quiero incorporar un sensor de flama(Digital), como hago el cambio en el IDE, para que este sensor de flama funcione.

De que sensor hablas? link, hoja de datos.

En ese URL, esta el sensor de flama que quiero utilizar, eso si por la via digital, ya que el mio no posee el pin Análogo.

Pero ese sensor es un SI/NO, o sea es digital pero es como un switch.
Eso es facil de implementar, de verás no sabes hacerlo?
La salida digital es simplemente un 0 o 5V LOW o HIGH y depende del preset. Tiene tambien una salida analógica.

Mira esta es la librería que usas RH_RF95 Library

Mira los ejemplos a ver si funcionan, y modifcamos uno con tu sensor de llama.
Este es demasiado complicado.

Link

Es lo mas parecido que encontre, pero no se si se puede adaptarlo a para un sensor digital. De todas manera te voy a dejar de los dos códigos que utilizo, para poder comunicar el sensor analogo (Dht2301).

Este código es del receptor

///
///                 Arduino      SX1278_Lora
///                 GND----------GND   (ground in)
///                 3V3----------3.3V  (3.3V in)
/// interrupt 0 pin D2-----------DIO0  (interrupt request out)
///          SS pin D10----------NSS   (CS chip select in)
///         SCK pin D13----------SCK   (SPI clock in)
///        MOSI pin D11----------MOSI  (SPI Data in)
///        MISO pin D12----------MISO  (SPI Data out)
///

#include <SPI.h>
#include <RH_RF95.h>

// Singleton instance of the radio driver
RH_RF95 SX1278;

int led = 9;

void setup()
{

  pinMode(led, OUTPUT);
  Serial.begin(9600);
  while (!Serial) ; // Wait for serial port to be available
  if (!SX1278.init())
    Serial.println("init failed");
  // Defaults init are 434.0MHz, 13dBm, Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on
}

void loop()
{
  if (SX1278.available())
  {
    // Should be a message for us now
    uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
    uint8_t len = sizeof(buf);
    if (SX1278.recv(buf, &len))
    {
      digitalWrite(led, HIGH);
      //RH_RF95::printBuffer("request: ", buf, len);
      Serial.print("Receive Message: ");
      Serial.println((char*)buf);
      //Serial.print("RSSI: ");
      //Serial.println(SX1278.lastRssi(), DEC);
      // Send a reply
      digitalWrite(led, LOW);
    }
    else
    {
      Serial.println("recv failed");
    }
  }
}

Este es del transmisor.

///
///                 Arduino      SX1278_Lora
///                 GND----------GND   (ground in)
///                 3V3----------3.3V  (3.3V in)
/// interrupt 0 pin D2-----------DIO0  (interrupt request out)
///          SS pin D10----------NSS   (CS chip select in)
///         SCK pin D13----------SCK   (SPI clock in)
///        MOSI pin D11----------MOSI  (SPI Data in)
///        MISO pin D12----------MISO  (SPI Data out)
///


#include <SPI.h>
#include <RH_RF95.h>
#define DHT11_PIN 0

// Singleton instance of the radio driver
RH_RF95 SX1278;

byte read_dht11_dat()
{
byte i = 0;
byte result = 0;
for(i=0;i<8;i++)
{
while(!(PINC&_BV(DHT11_PIN)));
delayMicroseconds(30);
if(PINC&_BV(DHT11_PIN))
result|=(1<<(7-i));
while((PINC&_BV(DHT11_PIN)));
}
return result;
}

void setup()
{
 DDRC|=_BV(DHT11_PIN);
  PORTC|=_BV(DHT11_PIN);
    Serial.begin(9600);
    while (!Serial) ; // Wait for serial port to be available
   
    if (!SX1278.init())
        Serial.println("Notice:init failed");
    
    // Defaults init are 434.0MHz, 13dBm, Bw = 125 kHz, Cr = 4/5, Sf = 128chips/symbol, CRC on
}

void loop()
{
byte dht11_dat[5];
byte dht11_in;
char humstring[3];
char tmpstring[3];
//String humidi;
//String temper;
byte i;
PORTC &= ~_BV(DHT11_PIN);
delay(18);
PORTC|=_BV(DHT11_PIN);
delayMicroseconds(40);
DDRC &= ~_BV(DHT11_PIN);
delayMicroseconds(40);
dht11_in = PINC & _BV(DHT11_PIN);
delayMicroseconds(80);
dht11_in=PINC & _BV(DHT11_PIN);
delayMicroseconds(80);
int x=0;
for(x=0;x<5;x++)
dht11_dat[x]=read_dht11_dat();
DDRC|=_BV(DHT11_PIN);
PORTC|=_BV(DHT11_PIN);
byte dht11_check_sum = dht11_dat[0]+dht11_dat[1]+dht11_dat[2]+dht11_dat[3];
if(dht11_dat[4]!=dht11_check_sum)
{
Serial.println("DHT11 checksum error");
}
itoa(dht11_dat[0], humstring, 10); 
itoa(dht11_dat[2], tmpstring, 10);
sensor_string[10] = humstring[0];
sensor_string[11] = humstring[1];
sensor_string[26] = tmpstring[0];
sensor_string[27] = tmpstring[1];
Serial.println("Sending to SX1278_server");
Serial.println(sensor_string);
// Send a message to SX1278_server
SX1278.send(sensor_string, sizeof(sensor_string));
Serial.println("mark0");
SX1278.waitPacketSent();
Serial.println("mark1");
// Now wait for a reply
uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);
delay(1000);
Serial.println("mark2");
}