hello team,
will be really great if anyone can help me to resolve my issue !!!!
Code am using:
#include <SPI.h>
#include <RH_RF95.h>
#include <String.h>
#include <dht.h>
#include <inttypes.h>
#include <stdint.h>
#define dht_apin A1
const PROGMEM uint16_t data[3];
dht DHT;
RH_RF95 rf95;
byte bGlobalErr;
String stringOne;
float frequency = 916.0;
void setup()
{
Serial.begin(9600);
if (!rf95.init())
Serial.println("init failed");
// Setup ISM frequency
rf95.setFrequency(frequency);
// Setup Power,dBm
rf95.setTxPower(13);
}
void loop()
{
DHT.read11(dht_apin);
Serial.print("Current humidity = ");
Serial.print(DHT.humidity);
Serial.println("% ");
Serial.print("Current Temperature = ");
Serial.print(DHT.temperature);
Serial.println("c ");
delay(100);
int val;
val = analogRead(0); //connect sensor to Analog 0
Serial.print("Moisture Level: "); //print the value to serial port
Serial.println(val);
delay(100);
const int AirValue = 520; //you need to replace this value with Value_1
const int WaterValue = 260; //you need to replace this value with Value_2
int intervals = (AirValue - WaterValue) / 3;
int soilMoistureValue = 0;
soilMoistureValue = analogRead(A0); //put Sensor insert into soil
if (soilMoistureValue > WaterValue && soilMoistureValue < (WaterValue + intervals))
{
Serial.println("Very Wet");
}
else if (soilMoistureValue > (WaterValue + intervals) && soilMoistureValue < (AirValue - intervals))
{
Serial.println("Wet");
}
else if (soilMoistureValue < AirValue && soilMoistureValue > (AirValue - intervals))
{
Serial.println("Dry");
}
delay(100);
typedef uint16_t UINT16;
uint16_t data[3];
data[1] = (DHT.humidity);
data[2] = (DHT.temperature);
data[0] = (val);
Serial.println(data[0]);
Serial.println(data[1]);
Serial.println(data[2]);
rf95.send(data, sizeof(data));
rf95.waitPacketSent();
// Now wait for a reply
uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);
if (rf95.waitAvailableTimeout(3000))
{
// Should be a reply message for us now
if (rf95.recv(buf, &len))
{
Serial.print("got a reply: ");
Serial.println((char*)buf);
Serial.print("RSSI: ");
Serial.println(rf95.lastRssi(), DEC);
}
else
{
Serial.println("recv failed");
}
}
else
{
Serial.println("No reply, is LoRa server running?");
}
delay(30000);
}
Its throwing me an error
no matching function for call to 'RH_RF95::send(uint16_t [3], unsigned int)'
My understanding is I have to use 2 bytes of data for my soil sensor but when I declare as uint16_t its throwing this error