Hi
I understood what you conveyed. But I am not knowing how to change in the program. I appreciate you, could you give demo examples or explain how to change in the program.
Suppose At Transmitter code (sx1272 with arduino uno ):#include <Wire.h>
// Cooking API libraries
#include <arduinoUtils.h>
// Include the SX1272 and SPI library:
#include "arduinoLoRa.h"
#include <SPI.h>
int Numbersample=22;
float x[22]={0.0};
int i;
int e;
char message1 [] = "Building1";
char message2 [] = "count";
in
boolean toggle = false;
unsigned long totalTime;
float output;
/*********SETUP FUNCTION ***********/
void setup()
{
Serial.begin(115200);
pinMode(12, OUTPUT);
// Print a start message
Serial.println(F("SX1272 module and Arduino: receive packets without ACK"));
// Power ON the module
e = sx1272.ON();
Serial.print(F("Setting power ON: state "));
Serial.println(e, DEC);
// Set transmission mode and print the result
e |= sx1272.setMode(4);
Serial.print(F("Setting Mode: state "));
Serial.println(e, DEC);
// Set header
e |= sx1272.setHeaderON();
Serial.print(F("Setting Header ON: state "));
Serial.println(e, DEC);
// Select frequency channel
e |= sx1272.setChannel(CH_10_868);
Serial.print(F("Setting Channel: state "));
Serial.println(e, DEC);
// Set CRC
e |= sx1272.setCRC_ON();
Serial.print(F("Setting CRC ON: state "));
Serial.println(e, DEC);
// Select output power (Max, High or Low)
e |= sx1272.setPower('H');
Serial.print(F("Setting Power: state "));
Serial.println(e, DEC);
// Set the node address and print the result
e |= sx1272.setNodeAddress(8);
Serial.print(F("Setting node address: state "));
Serial.println(e, DEC);
// Print a success message
if (e == 0)
Serial.println(F("SX1272 successfully configured"));
else
Serial.println(F("SX1272 initialization failed"));
analogReference(EXTERNAL); // use AREF for reference voltage
for(i=0;i<Numbersample;i++)
{
x[i]=(analogRead(A0));
}
}
void loop()
{
e = sx1272.sendPacketTimeout(8, message1);
Serial.print(F("Packet sent, state "));
Serial.println(e, DEC);
}
at the reciever (USB Gateway):/*
* ------ [SX_02b] - RX LoRa --------
*
* Explanation: This example shows how to configure the semtech
* module in LoRa mode and then receive packets with plain-text payloads
*
* Copyright (C) 2014 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
* Design: David Gascón
* Implementation: Covadonga Albiñana, Yuri Carmona
*/
// Include this library for transmit with sx1272
#include <WaspSX1272.h>
// status variable
int8_t e;
void setup()
{
// Init USB port
USB.ON();
USB.println(F("SX_02b example"));
USB.println(F("Semtech SX1272 module RX in LoRa"));
USB.println(F("----------------------------------------"));
USB.println(F("Setting configuration:"));
USB.println(F("----------------------------------------"));
// Init sx1272 module
sx1272.ON();
// Select frequency channel
e = sx1272.setChannel(CH_10_868);
USB.print(F("Setting Channel CH_10_868.\t state "));
USB.println(e);
// Select implicit (off) or explicit (on) header mode
e = sx1272.setHeaderON();
USB.print(F("Setting Header ON.\t\t state "));
USB.println(e);
// Select mode: from 1 to 10
e = sx1272.setMode(1);
USB.print(F("Setting Mode '1'.\t\t state "));
USB.println(e);
// Select CRC on or off
e = sx1272.setCRC_ON();
USB.print(F("Setting CRC ON.\t\t\t state "));
USB.println(e);
// Select output power (Max, High or Low)
e = sx1272.setPower('L');
USB.print(F("Setting Power to 'L'.\t\t state "));
USB.println(e);
// Select the node address value: from 2 to 255
e = sx1272.setNodeAddress(8);
USB.print(F("Setting Node Address to '8'.\t state "));
USB.println(e);
delay(1000);
USB.println(F("----------------------------------------"));
USB.println(F("Receiving:"));
USB.println(F("----------------------------------------"));
}
void loop()
{
// receive packet
e = sx1272.receivePacketTimeout(10000);
// check rx status
if( e == 0 )
{
USB.println(F("\nShow packet received: "));
// show packet received
sx1272.showReceivedPacket();
}
else
{
USB.print(F("\nReceiving packet TIMEOUT, state "));
USB.println(e, DEC);
}
}