Make+Spark_Project3.jpg

SerialTermVB.jpg

In my previous post, I described how I was able to program an iCop eBox to transmit date using an XBee wireless link. The program was written in Visual C++ and executed serial port commands to send data to a host computer. I had previously set up the XBees to communicate at 115,200 baud, but the Visual C++ serial port configuration defaults to 9600 for the baud rate. I was able to find sample code for It and it was relatively straightforward to add code to my program whichchanged the baud rate to the desired value.

Then things got a little strange. I noticed that every time I ran my program, it would hang after the serial transmission. I also found that the program would crash if I tried to send more than 16 characters. There’s a long list of possible causes for such crashes, and I started to debug them one by one. The important part of this story is the outcome. Honestly, debugging can be unpleasant. I like a good challenge and have always enjoyed solving puzzles, but that’s not how I wanted to be spending my time with these SPARK projects. So back to the outcome of the story. After taking many small steps backwards in the debugging process, I finally managed to make a huge leap forward, out of programming darkness. I now have a Visual Basic program running on my iCop eBox, and it’s sending and receiving data from another computer using XBee transceivers.

Why is this so great? That’s a fair question. Read on at the SPARK site for the answer!