Arduino-serial: C code to talk to Arduino

Technology
Arduino-serial: C code to talk to Arduino

Arduinong
Todbot writes –

“The Arduino’s USB port is actually a serial port in disguise. To your computer it appears as a ‘virtual’ serial port. This is good news if you want to write custom code on your computer to talk with the Arduino, as talking to serial ports is a well-solved problem. (Unfortunately, so well-solved that there’s many ways of solving it.)

On the Arduino forum there’s been a few requests for some example C code of how to talk to Arduino. The nice thing about standard POSIX C code is that it works on every computer (Mac/Linux/PC) and doesn’t require any extra libraries (like what Java and Python need). The bad thing about C is that it can be pretty incomprehensible.

Here is arduino-serial.c, a command-line C program that shows how to send data to and receive data from an Arduino board. It attempts to be as simple as possible while being complete enough in the port configuration to let you send and receive arbitrary binary data, not just ASCII. It’s not a great example of C coding, but from it you should be able to glean enough tricks to write your own stuff.”Link.

This is really interesting for a few dozen of you, so have at it.

Related:

  • Arduino – Link.
  • Wearable + Arduino – Link.
  • Arduino Fever – Link.
  • Chatter Pillow – Adium, PHP, Arduino, LEDs… wireless … – Link.
  • Sequence control – animation control with Arduino – Link.
  • Arduino boards @ Spark Fun – Link.
  • Arduino, the Basic Stamp killer? – Link.

Check out Tod’s book too.

Discuss this article with the rest of the community on our Discord server!
Tagged

current: @adafruit - previous: MAKE, popular science, hackaday, engadget, fallon, braincraft ... howtoons, 2600...

View more articles by Phillip Torrone

ADVERTISEMENT

Escape to an island of imagination + innovation as Maker Faire Bay Area returns for its 16th iteration!

Prices Increase in....

Days
Hours
Minutes
Seconds
FEEDBACK