Can we control to what device we want to talk to via that header?
Let's say to transmit one thing to my cell phone and another to my daughter's?
Can we control to what device we want to talk to via that header?
Let's say to transmit one thing to my cell phone and another to my daughter's?
No, what you transmit to is strictly set by pairing the 2 devices which is not part of this code. I don't think you can pair more than 2 devices. The header is just for validation of the data. The data received flag isn't raised until all data is received, without it the flag is raised as soon as data appears, and then you have to manually put the bytes into a string and wait until they all arrive.
Shawn
So let's say I have 2 garage door openers, I could pair with the phone, send that header and data defining if PIC should activate relay for left or right door button and then unpair phone?
Just making sure I can get 2 phones to be able to open either door (project #1).
Robert
Hi Robert - don't feel concern about using the code I posted; they are happy to have people use it. It only works on "Enterprise" though, I'm pretty sure.
The Bluetooth pairing with different devices is more a function of the module you use, I think. I've got a handful of cheap modules from offshore that I'm using with various PIC projects. you basically SERIN / SEROUT to the module and use the module like a serial port. I have paired/unpaired the same module to my development PC, my phone, and my old laptop, so it should happily do what you want. I'll dig back through my notes and post the device number if you wish.
Here you go:
Bluetooth Module
I use the Roving Network bluetooth device. RN-42.
It is pretty easy to use. I downloaded a serial port emulator for my android phone to configure it. Once I realized how the get the emulator to send the correct end of line character, it was pretty easy. The RN-42 allows you to rename the module, set BPS and a few other variables pretty easily.
On the B4A side, the online support is great. Their forum is very active and there are a bunch of other developers willing to help you sort out a problem.
Here are a couple of screen shots.
http://www.grahamelectricplanter.com...5-20-08-52.png
http://www.grahamelectricplanter.com...7-20-04-55.png
I initially was using a Motorola Xoom and because of supply problems now use a Samsung Galaxy. Everything still works great.
I will say the screen designer could use some touch up. Some basic, no pun intended...get it we are dealing with software called Basic for Android, is lacking. When setting up a screen you will be able to copy/paste yet not undo. I highly suggest 'Saving' the screen often. Other than that, it helped me quickly get an Android app going communicating with my PIC board.
After wrapping my brain around the problem, I finally stumbled across this thread.
I am trying to almost exactly the same thing; display a packet of 6 bytes spit out by the pic on an Android, using B4A in 6 different boxes.
The B4A side of things is completely unchartered territory for me; just figured out the advantages of using the prefix mode.
Now, I have a few questions; Shawn, in post#16, you have defined the prefix length to 22. But the decimal digits add up to 25. How is that?
As I said, my expertise on B4A is extremely mediocre; could you please show us the complete code on that side? For example, I am unclear (PLEASE forgive my complete ignorance, I suspect this is quite straightforward) how to fill up individual labels with the incoming data bytes from your Update_Display routine.
Thanks!
Anand
Bookmarks