Shop OBEX P1 Docs P2 Docs Learn Events
IPAQ to Stamp communications using Bluetooth — Parallax Forums

IPAQ to Stamp communications using Bluetooth

ArchiverArchiver Posts: 46,084
edited 2004-01-08 03:53 in General Discussion
Jon,

Doing Bluetooth is as easy as doing serial communiations. On
the Stamp side, the examples that come with the eb500 work
pretty well and you'll have no trouble using it.

In NSBASIC, the serial communications uses the 'comm' object
which works very similarly to the Visual Basic version.
Check the tech notes for details. It only took me a few
minutes to get a working program, once I figured out how the
IPAQ worked and how the NSBASIC did things, which took me
more than a day. Writing the bluetooth test code and
integrating it into my robot and writing thew NSBASIC remote
control only took a couple of hours.

On the IPAQ, Bluetooth is implemented (serial protocol) as
two comm ports, one for sending data and one for receiving
data. On the eb500, it is implemented in a similar manner.
Simply open the comm ports at the proper baud rate and just
send and receive data. The comm object defaults to
9600,n,8,1, just like the eb500 and all other Bluetooth
devices do in serial mode.

When you open the comm port, you will be asked for the
bluetooth device to connect to. I haven't figured out how to
automate this yet but I'm sure there is a way. Anyway, just
select the eb500 and the program will continue. Once the
comm port is open, just send data as though it was any other
serial device. It's that simple.

Transmitting to the Stamp is that easy. With very little
effort, I was able to write an application that sends
command codes to a hewcrawler and works very well. Most of
the time was spent getting used to the IDE and the IPAQ.
After that, it was just a matter of dealing with timing of
the data. Since the Stamp has no inbut buffer, I overcame
that by setting up a timer object (s309timer) to transmit a
single command character every 100ms (just to make sure that
when the stamp checked, there was data for it to see). This
is terribly inefficient, but my goal was to get something
working as soon as I could. Anyway, it works, not elegantly
but it works.

Now, on the down side, I can't get the darn thing to receive
data from the comm port or even be sure that the read port
is open. everything says it is but I get no onComm events.
The port is opened but never receives data. I havn't figured
out what's going on yet, I suspect the IPAQ itself is at
fault. I won't get a chance to work on it again until this
weekend, but this should get you all pointed in the right
direction.

I still need to solve this problem and to programatically
select the appropiate Bluettoh device, but hey, I only have
a couple of days experience programming IPAQs, my PDA
expertise was always on palms, but my top of the line palm
(tungsten C) will never support bluetooth GRRRR!

All in all, I am impressed in the transparancy of the
implementation on both the IPAQ and the eb500.

Now, back to that pesky receive problem...
--
Regards

Dave Evartt
American Hovercraft

Comments

Sign In or Register to comment.