HC-05

I know that you talked about and used the HC-05 BNS Bluetooth Library a long time ago, and I’m sorry for asking, but is there any way to change variables and debug when you are connected by sending data back to the robot? Thank you!

O ya pretty easily. The bluetooth connection works for sending and receiving.

How do you send data? And what data can you change within the robot while you are debugging? Can you send commands?

So you can send any raw information. The string “go home robot your drunk” for example. The robot has to be programmed to react to that msg though.

SendChar and
ReadChar are the functions for raw transmission of msgs in robotc. But if you don’t know much about writing custom packets you should probably take a look at the forum thread on BNS bluetooth.

You can make this thread public if you’d like. Nothing I’m saying is private and others might be interested.

Sounds good. I’ll do that. I’ve been reading through P3 Protocols trying to figure out packets for the past half hour… Do you know any good tutorials on sending packets over serial?

So for the most part a packet is just any collection of data. The nice thing when you are making both ends of communication is that you get to determine what is a “packet” and just make both sides of the communication use that system.

Imagine me trying to tell you the X and Y coordinates of a star. I would yell “Shadow 50 75” and you would realize the word “shadow” was me beginning my msg getting your attention and that the 2 numbers were x and y in that order. That is a perfect example of a simple packet applied to real life.

Start character (because using the name of someone is silly we use a single character to define starting"
information
information
information …

But for now if you just want simple commands to the robot you can just send a single character and have each character mean to do something different.
0 could mean spin
1 could mean drive straight

All the packet stuff really only makes sense if you want to have really robust 2 way communication and are programming something on the other end. If you just want to print wirelessly to your phone you can do it and if you want to manually type quick very precise msgs to your robot you can just get away without using a packet protocol.

I guess what you want to do with it will largely impact how you go about doing it.

What about if the data were compromised? In this analogy, what if I misheard you, and heard Shadow 50 80? Do I yell back for confirmation?

Furthermore, do we need an end to the packet? Is there contingencies of what would happen if Shadow were both the start of the message and a part of the message?