I am working on a project whereby I have an arduino recording the humidity and temperature levels of a room (using a DHT11 sensor), and a second arduino that recieve this data via bluetooth.
I am using the hm-10 BLE modules.
So far the data-collector can transmit data over BLE, and the reciever can recieve BLE data from my phone, but I can't figure out how to pair the two modules so that the receiver can receive data from the data-collector.
All of the solutions I have found online involve using the AT instruction set, whereas I am using the SoftwareSerial.h library.
The code for my data gatherer is as follows:
//Include the DHT (humidity and temperature sensor) library, and the serial library
#include <dht.h>
#include <SoftwareSerial.h>
//Define the constants for the input (DHT11) and output pins
#define RXpin 7
#define TXpin 8
#define DHT11_PIN 9
//Initialise a Serial channel as softSerial
SoftwareSerial softSerial(RXpin, TXpin);
//Initialise DHT object
dht DHT;
//Set initial measurement to be temperature (not humidity)
bool humidity = false;
void setup() {
//Start the serial function
Serial.begin(9600);
//Start the softSerial channel
softSerial.begin(9600);
}//void setup()
void loop() {
//Reset the reading variable
float(reading);
//Take in the values recorded by the DHT11
int chk = DHT.read11(DHT11_PIN);
//Store the necessary measurement in the reading variable
if (!humidity) {
reading = DHT.temperature;
} else {
reading = DHT.humidity;
}
//Output the reading on the softSerial channel
softSerial.print(reading);
//The DHT11 can only take one measurement per second, so waiting two seconds ensures there will be no null readings
delay(2000);
//Swap current measurement
humidity = !humidity;
}//void loop()
Any ideas on how I can connect it with another hm10 module so they can exchange information without having to re-write everything to the AT instruction set would be greatly appreciated.