How to control an Arduino from a PC

First of all, I'm very new to Arduino, so this is probably an easily answered question. What is the easiest/cheapest way to control an Arduino from a PC?

Via the USB cable.

I suspect you are asking for something else....

Write a program in VB/C/C#/whatever that sends commands to the Arduino via the USB.
Write a program on the Arduino that parses these commands.


Rob

My take on "whatever" is to use a language called Processing, it is free to download and use and remarkably similar to the Arduino code.
Well not so remarkable actually as the Arduino was derived from it.

@058686 - I translated you.

The message says:

My Instructables username is RoboGeekDude12!

http://home2.paulschou.net/tools/xlate/

I know this might not seem helpful, but the answer is "You control the Arduino with bi-directional RS232 SERIAL DATA transfers".

So.... any progamming or scripting language that supports RS232 Serial interfacing is how you control the arduino, so as Mike says... work with what you are comfortable with... or try Processing.

You got it right!

Si:
@058686 - I translated you.

The message says:

My Instructables username is RoboGeekDude12!

http://home2.paulschou.net/tools/xlate/

Yes, I'm asking for what language to use, and how to make it "tell" the Arduino what to do.

Msquare:
Via the USB cable.

I suspect you are asking for something else....

May I have examples of those programs (Arduino and C#) please?

Graynomad:
Write a program in VB/C/C#/whatever that sends commands to the Arduino via the USB.
Write a program on the Arduino that parses these commands.


Rob

May I have an example?

Grumpy_Mike:
My take on "whatever" is to use a language called Processing, it is free to download and use and remarkably similar to the Arduino code.
Well not so remarkable actually as the Arduino was derived from it.

I tried for a long time to interface my Arduino with C++ but I couldn't find any working library, so now I'm using processing every time I need a custom computer interface.

Jan

P.S. 058606: I'm almost the same age as you are (14, soon 15).

EDIT: Arduino Playground - InterfacingWithSoftware

Actually interfacing depends on your knowledge.
Since Arduino is serial enabled you can send (and receive) serial messages through any serial enabled software on windows. You can use Telnet, Hyper Terminal, Putty and other similar programs to communicate directly with Arduino or you can create your own solution based on any serial enabled development platform. You can even use AutoIt3 to send and receive serial commands from you computer to your hardware.

In my personal opinion if you want to create your own interface for controlling devices the best way to go is Visual Studio (language depends on your experience). Visual Studio examples are plenty now-days so its easy to learn by searching on the web.

I am using C# to communicate with my arduino projects. Not sure if it is the easiest way there are, but it is easy for me because I can C#...

How to read serial with C#: Mikeys Notes

I've used VB.net for this in the past and that's fairly easy. The best example I have is

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim i As Long
        Dim s As String

        If Not SerialPort1.IsOpen() Then
            SerialPort1.Open()
        End If

        TextBox1.Text = ""
        TextBox1.Refresh()
        Do While i < 50
            SerialPort1.Write("<hello>")
            s = SerialPort1.ReadLine()
            TextBox1.Text = TextBox1.Text + s + vbCrLf
            TextBox1.Refresh()
            i = i + 1
        Loop

    End Sub

    Private Sub Form1_Disposed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Disposed
        If SerialPort1.IsOpen() Then
            SerialPort1.Close()
        End If

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        SerialPort1.PortName = "Com33"
        SerialPort1.Open()
    End Sub
End Class

(I must clean this up one day to just echo characters).

However the simplest thing to do is just use one of the terminal progs mentioned above, or even the IDE serial monitor. That way there's no PC programming to do at all.


Rob

You might also find it useful to take a look at Bitlash, http://bitlash.net -- Bitlash is a shell language interpreter that runs on the Arduino, and it is easily controlled from the PC side by typing or sending commands through the virtual serial port. You can store macros in EEPROM to automate small applications.

Download and doc at http://bitlash.net, and some application thoughts on my blog at http://entropymouse.com

Happy hacking,

-br

http://entropymouse.com

058606:
Yes, I'm asking for what language to use, and how to make it "tell" the Arduino what to do.

My "vote" is for the Processing program, given the broadness of your query. Other forum uses suggested it, too, earlier in this thread. One thing may be confusing - Processing is Java based, and the Arduino is C++ based, so the languages are similar but there are quirks of syntax that drive me mad when writing in both IDEs for the same project.

With Processing you still have to write a program to use the pc mouse/keyboard/screen, and then you can use the same Serial-style library to send bytes with commands and parameters to the Arduino board. You still have to write an Arduino program to recieve and interpret the bytes and do what it needs to do to the pins (and the same with sending results the other way). There is a readymade program Firmata for the Arduino that makes it easier to control it from the Processing program (or any other program on th pc), but I have not tried it ior looked at it in detail.

EDIT: Just saw a good example at http://arduino.cc/forum/index.php/topic,50449.msg359623.html#msg359623

(NB: This was my 100th post)