This is my first project using bluetooth module HC-05.i am using two of this module.one is with arduino nano(slave) and another one is with arduino uno(master).I have paired them through AT commands . for testing,i was giving a pulse in pin 7 on nano.if there is a pulse,then slave will send character "1".if not then it will send "0".

in UNO there is an LED connected with pin 13.if master receives '1',then LED will on and if recieves '0',LED will remain off. here is my source code ----------

slave code=> enter image description here

master code=> enter image description here

the Arduino IDE isn't showing any bug,but code is not working at all.though,i am giving pulse in pin 7 on NANO, the LED in pin 13 on UNO is remaining off.i am at aloss now.please help me as soon as possible..

  • 1
    Is copy pasting code really that hard? – gre_gor May 10 '17 at 14:08
  • sorry,I didn't get you. – Rakibul Islam Prince May 10 '17 at 15:07
  • sorry...the main code has now been attached. – Rakibul Islam Prince May 10 '17 at 15:12
  • Does CTRL + C and CTRL + V ring a bell? – gre_gor May 10 '17 at 16:38
  • bro,would you please give me any solution? – Rakibul Islam Prince May 10 '17 at 17:01

Don't put pictures of you code in a post again, makes life very difficult!

The problem is the first line of the slaves loop

    if (slave.available()>0)  // Here is the bug

So If the "slave" serial port has data available to read then write data. The master never writes to the slave so the slave never has any data to write, so your slave never sends any data and your master never reads any data.

In short remove that line and it will work.

| improve this answer | |
  • sorry,I'm new to this group.so i didn't know the rules.But ,it still is not working,though i have removed the line.now the indication LED on HC-05 is flashing very quickly. – Rakibul Islam Prince May 10 '17 at 16:17
  • arduino RX=>TX of hc-05 and arduino TX=>RX of hc-06 ........this connections are same for both master and slave...for your convenience i have added these information. – Rakibul Islam Prince May 10 '17 at 16:28
  • at last,fixed it – Rakibul Islam Prince May 10 '17 at 18:28
  • What fixed it? If it was this please mark this as the answer to help others, if not answer the question yourself. – Code Gorilla May 11 '17 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.