MakerGram Logo

    MakerGram

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Tags
    • Users
    • Groups

    Help need in Arduino coding : Arduino with HC05

    Arduino
    arduino bluetooth
    2
    2
    150
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Geethesh
      Geethesh last edited by salmanfaris

      Plese help me to make a Arduino program to make the led blink continuously, when the hc-05 bluetooth module get disconnected from mobile.

      1 Reply Last reply Reply Quote 0
      • salmanfaris
        salmanfaris last edited by

        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 .

        1 Reply Last reply Reply Quote 1
        • First post
          Last post

        Recent Posts

        • S

          @salmanfaris Actually, I can't connect my NodeMCU device with the localhost server. I can establish a connection using the test.mosquitto.org server.
          This is my required case: YouTube link

          • read more
        • @sivanath From your last message looks like the MQTT broker already running on your computer. Could you please try to do a test with nodeRED and see it's working or not.

          • read more
        • S

          @swalahamani I may not be able to come tomorrow. I think we could set up a call. How can I contact you personally?

          • read more
        • @sivanath

          Oh okay.

          Please bring your device if you're coming for the upcoming MakerChat 0x13 tomorrow (IST). Either I and @salmanfaris or both of us will be there.

          Or else we can set up a call sometime this weekend or the next week and sort it out.

          Let me know.

          • read more
        • S

          @swalahamani Yeah!!

          • read more
        By MakerGram | A XiStart Initiative | Built with ♥ NodeBB
        Copyright © 2023 MakerGram, All rights reserved.
        Privacy Policy | Terms & Conditions | Disclaimer | Code of Conduct