1242Views13Replies

Author Options:

How to send information between 2 HC-05? Answered

I need to send a number from 1 Arduino to another using 2 HC-05. I have followed the AT setup and connection in this video https://www.youtube.com/watch?v=hyME1osgr7s. I have successfully connected 2 HC-05 module but I can't get the master to send a relatively large number to the slave. I uploaded my code and result--serial command is the slave's (Basically I want the slave to receive the number and print onto serial screen, but it doesn't happen)

Another question is if I want to send 3 integers in a row (Like 23, 34, 56) and let the other receive as 3 different integers (int1=23, int2=34, int3 = 56), how do I do that?

Btw, how do I suppose to upload the files to Arduino properly? When I have the TX->RX0; RX->TX1 (Bluetooth pin to Arduino pin), I can't upload the file. I have to disconnect and upload, then it seems to upload but doesn't work properly.

Thanks in advance.

14 Replies

user
icengBest Answer (author)2017-02-12

Pick another two pins set as TX, RX...

Remember
the code load TX, RX are specially software bound to look for control
codes and placement to memory... You want one bit for one bit interpretation...

I would first try direct wire communication and then insert HC-05 after flawless TTL works....

Do you know how to write code or are you inserting code without modification ??

Select as Best AnswerUndo Best Answer

user
Shizen (author)iceng2017-02-13

I'm completely new to serial connection so I just insert the code without any modification, can I have some guide please?

Select as Best AnswerUndo Best Answer

user
iceng (author)Shizen2017-02-13

This text box is too small to teach a semester of high school programming let alone Hexadecimal numbering system of changing decimal to binary bits...

Consider this;

Decimal 13 is Binary 00001101 is Hex 0D is Octal 015 is Character CR ........................the control Character for a carriage_return...

Dec 49 is Bin 00110001 is Hex 31 is Character 1

Dec 51 is Bin 00110011 is Hex 33 is Character 3

Dec 65 is Bin 01000001 is Hex 41 is Character A and finally

Dec 122 is Bin 01111010 is Hex 7A is Character z .....

In your head what is the Decimal value of Binary 01000100 Char D ??

Select as Best AnswerUndo Best Answer

user
Shizen (author)iceng2017-02-14

lol, I actually learn Binary, Decimal and Heximal before

01000100 in Decimal is 68, meaning Hex 44, character 'D'

I was taught how to convert them, not how to use them....

Select as Best AnswerUndo Best Answer

user
iceng (author)Shizen2017-02-15

Sure makes sense if 65 is 'A',,, 66 is 'B'... 67 is 'C'... THeN 68 has to be 'D'...

Ever notice the numbers start out with a 3n Hex makes decoding a snap...

Select as Best AnswerUndo Best Answer

user
Downunder35m (author)Shizen2017-02-13

Just head over to the Arduino Playground and check the examples for the serial write and serial read command or for serial communication in general.
Take some of the examples to test that you setup and connection is actually working as planned.
After that you already know where you went wrong before and can implement what Steveastrouk suggested.

People always underestimate how much info you can find in the playground...

Select as Best AnswerUndo Best Answer

user
Downunder35m (author)2017-02-12

You do realise that a serial connection only uses 8 bit?

Select as Best AnswerUndo Best Answer

user
Shizen (author)Downunder35m2017-02-13

Oh, so the maximum is 127 or 255? I didn't know that...

Select as Best AnswerUndo Best Answer

user
steveastrouk (author)Shizen2017-02-13

No, you use ASCII, and send the number as strings so your number 1234 is sent as characters, like "1""2""3""4" and then character &0D

Select as Best AnswerUndo Best Answer

user
Shizen (author)steveastrouk2017-02-14

I need to read more on the communication itself, I can turn from char to int.

However, I don't know how to send the character from 1 to another Arduino, that's what I'm looking for right now

Select as Best AnswerUndo Best Answer

user
steveastrouk (author)Shizen2017-02-14

One end transmits <CR>DATA<LF> The other picks up the <CR> as the start of a message, and buffers the data until it picks up <LF> then it parses it.

Select as Best AnswerUndo Best Answer

user
Shizen (author)steveastrouk2017-02-14

Ok, thanks, I think I can start looking around now

Before I have no idea on what to look up...

Select as Best AnswerUndo Best Answer

user
iceng (author)steveastrouk2017-02-14

Which is

Decimal 13 is Binary 00001101 is Hex 0D is Octal 015 is Character CR ........................the control Character for a carriage_return...

Select as Best AnswerUndo Best Answer

user
Shizen (author)iceng2017-02-14

OHHHHHHH, that make so much sense now. I just check ASCII table again, now I understand what the first column is about (before I only work with characters)

Select as Best AnswerUndo Best Answer