Does a Basic Stamp API exist?
Jeff Gerber
Posts: 6
This is my first post in the forums, so hello to everyone! Searching for API turns up zero results in the forums so I have to ask: What/Where is the API for interacting with the BASIC Stamp, as opposed to using the "BASIC Stamp Editor"? The intent is of course to be able to write an application of my own design (e.g. write an app in my language of choice to read data output from the BASIC stamp and display it as a graph). (Apologies, I have no idea how to get CR/LF to work in this HTML editor.) -Jeff
Comments
If you can program on the PC (or Mac) side to read the serial port properly, you can write in whatever language you want, and set up whatever serial data format you care to on the Stamp side.
The only real caveat with the serial conn. to the PC on the Stamp is that the RS-232 circuitry on the Stamp will cause all characters to "echo", so you need to accommodate that in your PC application.
It is designed to accept serial data and display it in a variety of formats.
You could have code that sends an ASCII header, followed by 3 bytes of binary data, e.g. "ATTN1:",%01010101,,%01010101,%01010101
If you want a checksum, write the code that way for the Stamp. If the Stamp is "slaved", then the program in the Stamp can wait for a specific serial string (as a kind of header) followed by data from the PC, or just presume that activity on the serial line is the start of bytes, or whatever you want to do.
The Stamp can be kind of slow (esp the slower members of the family) to setup and/or parse out data as it goes out/in, so you may want to keep that in mind for the host side, and have the host app be somewhat tolerant of space between bytes in a serial stream. Likewise the changeover from SERIN, say, accepting a command, and then SEROUTing to send the PC data can be slow, relatively.
I wrote a tiny in/out program on the stamp and also an app just as tiny in C# and it worked immediately.
I've been kicking around writing a .NET API for the stamp, just to facilitate comms, if i get anything solid and usable, i'll post it