You're going to have to post all of your code, I mean you have a serial print in your code and yet I don't see that line anywhere in your output. Also I cannot see what you've got the rather ambiguous variable e set as, or what type it is either.
The function getRSSIpacket() is a function that comes with the library with the radio. This is example code that comes with the library. e is set to the output of the function, which is printed on the serial output. e is an int. I've posted all of the code at the bottom of this message.
The serial output is, I posted is from the line
Serial.println(e, DEC);
I'm not sure what is the purpose of the line:
Serial.print(F("Receive packet timeout, state "));
I was thinking that I would have to parse the output of the serial output to the get the line 'data' as a char and then parse this line and set the 5 th char and set this equal to ID (which is an int)? FYI, I need to set all the numbers equal to variables but I'm just practicing.
Kind regards
C
/*
* Semtech SX1272 module managing with Arduino
*
* 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 Lesser General Public License as published by
* the Free Software Foundation, either version 2.1 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 Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Version: 1.0
* Design: David Gascón
* Implementation: Covadonga Albiñana
*/
// Include the SX1272 and SPI library:
#include "SX1272.h"
#include <SPI.h>
int e;
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(115200);
// Print a start message
Serial.println("SX1272 module and Arduino: receive packets without ACK");
// Power ON the module
sx1272.ON();
// Set transmission mode and print the result
e = sx1272.setMode(1);
Serial.println(e, DEC);
// Select frequency channel
e = sx1272.setChannel(CH_16_868);
Serial.println("Setting Channel: state ");
Serial.println(e, DEC);
// Select output power (Max, High or Low)
e = sx1272.setPower('L');
Serial.println("Setting Power: state ");
Serial.println(e);
// Set the node address and print the result
e = sx1272.setNodeAddress(8);
Serial.println(e, DEC);
// Print a success message
Serial.print("SX1272 successfully configured ");
}
void loop(void)
{
// Receive message
e = sx1272.receivePacketTimeout(10000);
e = sx1272.getRSSIpacket();
Serial.print(F("Receive packet timeout, state "));
Serial.println(e, DEC);
}
So I have a have a data packet coming in as '012345678901234' and I am assigning parts of it to 3 variables - id, vbat and temperature.
The variables id and vbat are being correctly assigned to the right numbers in the packet. But for some reason temperature is being assigned '0189674312' instead of '01'
You'll see in the definition below that the variables id and temperature are both an array of 2 chars.
You probably can capture all the data received as a String, then use the String functions to capture the desired section of data. You might also use the below textfinder application.