Let's Make Robots!

Terminal Emulator and/Processing help

While I am waiting for parts, I am back to playing with my bluesmirf. I running a simple loop in processing to spit out a single byte, delay and loop again. The picaxe simply sits on a serin command and echos back to the pc via a sertxd command. I am getting bad data. I simply get a 0 or 255 depending on if I set the picaxe to recieve data inverted or not. I am thinking that somehow the unit has reset itself to factory settings and is back to being set at 115,200 baud. I need to bring it down to 9600. Now, I have established a pairing and a connection via processing and with some simple test codes have put it into "command mode" as indicated by the LED's. However, I am very limited as to my knowledge of processing and I have not been able to go further than that. Basically, I can send a command, but I am unsure as to create a loop where the response is recieved thus triggering the next needed command send.

The other option is a terminal emulator but I have used up my free hyperterminal trial and I need a suggestion of another free one I can use. I need something very, very simple and some ideas on where the settings should be. I just want a line where I can type the command I want to send and a CR in a little box and just hit return. I want the unit's response to show up in another box. Is there something out there that simple? By the way,. the bluetooth module appears to the computer as just another serial port.

I would love any advice you guys have in terms of which way to go.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Thanks to the superior knowledge of Tin Head, Voodoo and rik (and the magic of Skype) we are good to go!

Keep your eye out for upcoming posts!

See ya around CtC :)

Command mode: Yes, I can get it in command mode because I was able to send the command at 115200 via processing. But again, I am still just cutting and pasting when working with processing and still don't know about loops and sequences. I have deciphered most of the commands but I just need to learn about how all the { } stuff works. My intention was to simply get a serial connection going thus allowing me to then do some learning tests sending various chunks of data back and forth. Thanks, voodoo by the way for the repost of your bt work.

Now in terms of serial/ bluetooth, I have already paired and the computer does not seem to even care that the bluetooth even exists. When the processing code is run, the bluesmirf goes into data mode (as shown by a solid green led) and the computer sees this as a serial connection. Basically, the bluetooth is irrelevant --the computer and processing think and act as if they are just sending data to a virtual serial port (just like the usb/ serial converter I use to sync my picaxe --the converter is not noticed, if you go and look at your connections in the control panel, it just show com_whatever and serial port.)

--Yes, I am getting a 255 or 0 no matter what I am sending. I can varify the send and receive, and again the bad data just screams "wrong baudrate" to me.

Rik --Thank you for your processing advice and I still want to really learn a big-boy language so I will be returning to your advice, for now, I just need to send an "A" and get an "A"!

I have time today to go through your suggestions, everybody --I will let you know what I find.


I posted the picaxe files as well just a little while ago. They were on another machine so had to fire that one up. See if that helps you out. It works great for me and I get data without issues....

One thing to point out in the code, I take the input as a byte and convert it to a char or int as it comes in as numeric values. I think you'll see what I mean when you look at the code.

I send A I get 65...which is the asci value for A

Right now, I simply don't care if it comes in as ascii or bin or anything else. I just need a simple proof of concept and a clean data send. --From there I can convert the 65 back to an A etc.

rinkel de kinkel!

Let's talk Processing instead. When you say "loop", I hear "endless". But I expect you need just a sequence. The sequence might restart when finished.

So your processing code would send a first command, wait for response from the the counterpart. Then send the second response, wait some more. Etcetera. Am I getting this right so far?

I suspect that the "waiting for a response" part is tricky for you. After that, the problem might be to make the sequence somewhat flexible, programmable.

Waiting for a response: the tricky part is, you are already looping in the code section void draw. So every time the code passes the start line, it should check the incoming buffer to see if anything has been added since last time. I am assuming your bluesmirf is connected like any other serial device. So I am using an abbreviated example from processing.org

import processing.serial.*;
Serial myPort; // The serial port

void setup() {
myPort = new Serial(this, Serial.list()[0], 9600);

void draw() {
while (myPort.available() > 0) {
int inByte = myPort.read();

Now mentally replace "serial" with "smirf-whatever" and read the code again:

setup your hardware yadayada
start flooping
  check if input buffer has got anything, while there is still stuff there
    read it, one byte at the time (this removes that byte from the buffer)
    write it onto the screen (this is your proof of concept)
  ready with checking
floop around

The serial library allows you to zjink any kind of data blob from the buffer; byte, bytes, character, all.

Programming adequate responses: This can be done in numerous ways. A hard coded sequence could "programmed" into an array of bytes or chars or strings. Just keep a counter and spew out the counter-th item in the array.
An adaptive response would be programmed the good-old fashion "if ... then ... else" way. Or "switch". Or whatever.

Hope this helps. Let us know.

That is exactly the code i am using to read from the "buffer". However, i simply don't know how to assemble and loop/ sequence anything. Where I sit now, to get processing to check if it has gotten a response during each loop, I am also looping (and sending over and over) the commands to change the baud rate. I simply don't know how to set-up a subroutine of "check response". I don't know how to check what is recieved and based on that, send the next command. If I had an essay to write for school, this is like trying to write it in French by cutting and pasting without knowing how a sentance is structured!


The serial library was a  bit unstable for me when it came to trying to reestablish connections. If I disconnected after the first connection and retried, I wouldn't see the bt device again until restarting processing. The bluetooth library is the way to go though a bit trickier to set up initially.

... Putty supports serial connections ... I use the thing all the time.

Check under Configuration -  Connection - Serial.