Help need in Arduino coding : Arduino with HC05
-
Plese help me to make a Arduino program to make the led blink continuously, when the hc-05 bluetooth module get disconnected from mobile.
-
Hi @Geethesh , Since HC05 is Interfaced with Serial (UART), you can check whether it connected or not in the Serial.available() function call.
if (Serial.available() > 0) { // Checks whether data is comming from the serial port data = Serial.read(); // Reads the data from the serial port } else { // Write what you need if serial is not connected }
full Implementation .
#define led 13 void setup() { Serial.begin(9600); pinMode(led, OUTPUT); } void loop() { if (Serial.available() > 0) { // Checks whether data is comming from the serial port data = Serial.read(); // Reads the data from the serial port } else { ledBlink(); } } void ledBlink() { digitalWrite(led, HIGH); delay(100); digitalWrite(led, LOW); delay(100); }
All the best .