Hello guys and gals, i'm making a flood sensor that is connected to a Bluetooth module, that can send a message to my phone when it registers water.
The problem is that i have little to no idea how to code, and the deadline for finishing my project is in 2 weeks, everything is fine and dandy except the part where i have to make the Bluetooth module send a message to my phone.
I don't know how i would code this, so i would really appreciate it if somebody could help me with it. So far i have a water sensor with a buzzer and LED that activates when the sensor detects water. I just need help with coding the Bluetooth module.
I have attached a file with the code i have right now.
EDIT:
Here's the schematics of the Arduino with sensor, LED and buzzer. I understand i will need to use a external board to fit the Bluetooth module aswell if i'm correct.
Image of the Bluetooth module (HC-05) i'm using:
Here's the code:
int WaterAlarm = 1;
int Buzzer = 9;
int Led = 10;
boolean val;
int tones[] = {261, 277, 293, 311, 329, 349, 369, 392, 415, 440, 466, 493, 523 ,554};
void setup() {
Serial.begin(9600);
pinMode (WaterAlarm, INPUT);
pinMode (Buzzer, OUTPUT);
pinMode (Led, OUTPUT);
}
void loop() {
val = analogRead(A0);
Serial.println(val);
if (val == 1)
{
digitalWrite(Led, HIGH);
digitalWrite(Buzzer, HIGH);
tone(Buzzer, tones[6]);
delay(200);
digitalWrite(Led, LOW);
digitalWrite(Buzzer, LOW);
noTone(Buzzer);
delay(200);
digitalWrite(Led, HIGH);
digitalWrite(Buzzer, HIGH);
tone(Buzzer, tones[14]);
delay(200);
digitalWrite(Led, LOW);
digitalWrite(Buzzer, LOW);
noTone(Buzzer);
delay(200);
}
else
{
digitalWrite(Led, LOW);
digitalWrite(Buzzer, LOW);
}
}
Code_Flood_Sensor.ino (865 Bytes)