Friday, December 18, 2009

Serial comms

One thing about Arduino that I liked the sound of is the option of communicating directly with a PC via USB.  I have looked at how it's done, the simplicity is great, these two lines of code send the text to the PC.

Serial.begin(9600);
Serial.println("Hello world!");

There's also the means to send data to the controller.  I have looked at this a bit more and it turns out that there are two pins that act as the send and receive and run at TTL levels, as you might expect.  The clever bit is in two parts: first the interface to USB and second the language support.  The interface is provided by FTDI hardware.  This is available separately and could easily be used for other microcontrollers.  The language support is what really makes it easy.  The Serial object means comms to a PC, or to other serial devices is a breeze.

No comments:

Post a Comment