Let's Make Robots!

Talk to my computer through Serial?

Long time no see LMR!!!!

This semester was my most brutal yet, but the rewards have been priceless!


Anyways, back to the robots,

So my current project is to create a virtual indentity that I can have a VERY simple conversation with. His name is Sergei, cause everyone needs an awesome Russian buddy. But I find myself being a bit stuck on one thing: Serial Communications


What Im really trying to better understand is how to make the Arduino respond to my serial input. 

Here is another link detailing it:  

I know all the information is there but I just keep missing something..... I cant seem to get any of it to work. 


For a test, I want to say "Hola" in the serial input and the computer says "welcome, Doug" in response. I cant imagine its a very complicated code but if anyone has seen any examples, please share them!

Comment viewing options

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

The code compiles and uploads well, it doesnt seem to control the LED on the arduino board (havent hooked it up to an external LED) but the serial responses are perfect! Now that I have a working code I need to learn what makes it work ;)


Ive read through it and really only one part confuses me:

 if (character != '\n') {

 readString.concat(character); // get it


Can you explain this portion to me?

I'm a bit puzzled why the led doesn't respond for you, as I tested the code on my arduino duemilanove 100 percent.
 Is your led on pin 13?

The section of code tests if the next character is a carriage return, if not then add the character to readString.
A carriage return is when you hit enter and is usually how one determines the end of a communication in serial.


\n is the special character for line feed
\r is the carriage return character

@DougG3: If you look for escape characters, you will find a list of 10 or 15 that include \t (tab), \\ (\), \' ('), among others.

@merser: it would seem the only thing my code was missing is a delay.

Yes \n for new line, doh! regardless it's the terminator used for serial.

Other than the delay,  you missed an equals sign for your INTERMINATOR assignment otherwise yeah yours should work.
I thought you had a good start on the problem, I just picked it up and finished it, plus had the advantage of having an arduino to test it on.

but changing to pin 23 works an external led just fine. Thanks, everybody!