Go Down

Topic: How to control an Arduino from a PC (Read 5203 times) previous topic - next topic

58606

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?
const bool loveElectronicsRelatedThings = true;

Msquare

Via the USB cable.

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

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
Rob Gray aka the GRAYnomad www.robgray.com

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.

Si

@058686 - I translated you.

The message says:

Quote
My Instructables username is RoboGeekDude12!


http://home2.paulschou.net/tools/xlate/
--
My New Arduino Book: http://www.arduinobook.com

pwillard

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.

58606

You got it right!


@058686 - I translated you.

The message says:

Quote
My Instructables username is RoboGeekDude12!


http://home2.paulschou.net/tools/xlate/
const bool loveElectronicsRelatedThings = true;

58606

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


Via the USB cable.

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

const bool loveElectronicsRelatedThings = true;

58606

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


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

const bool loveElectronicsRelatedThings = true;

58606

May I have an example?


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.
const bool loveElectronicsRelatedThings = true;

JanD

#10
Jan 28, 2011, 09:39 pm Last Edit: Jan 28, 2011, 09:41 pm by JanD Reason: 1
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: http://www.arduino.cc/playground/Main/InterfacingWithSoftware

limbo

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.
 

bld

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#: http://captain-slow.dk/2010/12/26/read-serial-from-an-arduino/
captain-slow.dk | non contagious!

Graynomad

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

Code: [Select]
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
Rob Gray aka the GRAYnomad www.robgray.com

billroy

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://bitlash.net
http://entropymouse.com

Go Up