How can I send data to the arduino from the computer?

How can I send data to the arduino from the computer? I'm thinking sort of a prompt on the command line and some commands like "led1 on". Then, the arduino would process that and light up a certain led.

-
 opencircuits.com/Arduino_Command_Interpreter for example – russ_hensel Apr 1 '11 at 3:38

You can use Serial.print("DATA") and on your pc build a program that listen on serial port.

if (Serial.value == "DATA") {
doWork()
}


When you get correct value, do anythink.

Like gMail notifier.

hope this helps.

-

One of my favorite features I added to a project years ago was to implement a VT100 terminal. It was a pretty simple and flexible way to allow users to configure our Ethernet-based devices over an RS-232 connection. It had a tabbed interface, status updates, and could also accept commands. You can get surprisingly fancy with this simple approach.

-

Something that you can take advantage of is the Firmata approach. It's basically a way to control ports / read inputs on a microcontroller using serial commands (which sounds like what you're trying to do).

There is already a Firmata library for Arduino here. There are also a number of programs that implement the PC end of the conversation.

-

Your plan should work fine. You do not say what computer you have (PC Mac Linux etc.) but obviously you will need a program running on the computer that acts as a terminal emulator and allows you to send the command to the Arduino.

On the Arduino side you need to parse or decode the command, so best to keep the commands as simple as possible. For example instead of "Led 1 on" perhaps "L1+" and "L1-" to turn it on and off.

Many other people have done this sort of thing with Arduinos so if you Google you should find ots of samples.

-

The way I do it is with Max and the [serial] object. You can implement a simple terminal using the text editor GUI object. PureData is a free alternative, which has a similar solution, though I'm not sure what the object for serial communication is called.

-

From the site: "... allows you to examine memory, examine and toggle I/O pins, explore the mapping of Arduino pin numbers to AVR port names and bit numbers, scan I2C bus, look at interrupt vectors and much more. "

-