Please help !!
I am currently making a plant monitor system for college. I am fairly new to programming and could use some help. So far, I have successfully amalgamated serval programs into a complete program that can monitor lux levels, display heat and humidity on a LCD screen and a soil sensor that will determine if the soil is dry and turn on a buzzer as a warning. the code is below:
// light
int sensorPin = A0; // select the input pin for the potentiometer
float rawRange = 1024; // 3.3v
float logRange = 5.0; // 3.3v = 10^5 lux
//heat
#include <dht.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
dht DHT;
#define DHT11_PIN 7
// soil sensor
int led_pin = 9;
int sensor_pin = 8;
void setup()
{
//light
analogReference(EXTERNAL); //
Serial.begin(9600);
Serial.println("Adafruit Analog Light Sensor Test");
//heat
lcd.begin(16, 2);
//soil
pinMode(led_pin, OUTPUT);
pinMode(sensor_pin, INPUT);
}
void loop()
{
// read the raw value from the sensor:
// light
int rawValue = analogRead(sensorPin);
Serial.print("Raw = ");
Serial.print(rawValue);
Serial.print(" - Lux = ");
Serial.println(RawToLux(rawValue));
delay(1000);
//heat
int chk = DHT.read11(DHT11_PIN);
lcd.setCursor(0, 0);
lcd.print("Temp: ");
lcd.print(DHT.temperature);
lcd.print((char)223);
lcd.print("C");
lcd.setCursor(0, 1);
lcd.print("Humidity: ");
lcd.print(DHT.humidity);
lcd.print("%");
delay(1000);
//soil
{
if(digitalRead(sensor_pin) == HIGH)
{
digitalWrite(led_pin, HIGH);
}
else
{
digitalWrite(led_pin, LOW);
delay(1000);
}
}
}
float RawToLux(int raw)
{
float logLux = raw * logRange / rawRange;
return pow(10, logLux);
}
The problem i now have is i would like to receive the lux levels that are printed on the serial monitor over Bluetooth. I have purchased a HM-10 module, which after some research can connect to an iPhone. However, i am unsure on what i need to do (connection wise, additional programming and an app to use) to make this work. Can anyone with some expertise please assist.
Many thanks Tom