Sending commands to an arduino

Hi guys,
I have been working on building a robot and have chosen an arduino mega to function as my I/O board. As my role in the team concentrates mainly on building, I am lost when it comes to programming the darn thing. I have mastered programming the arduino, using the native language (something akin to C++), but have yet to be successful in controlling it remotely.

My dilema centers around my inability to write a dashboard program. I would like to know how to send serial data (in the form of numbers) to the arduino using LabView.

Thanks in advance for any advice that you give.

I don’t have an answer for you, but the Arduino Mega supports I2C, and the Digital Sidecar also speaks I2C. Similarly, the cRio speaks Serial Data (RS-232 I believe) as does the Mega (but you may need a simple lever converter like a MAX202)

Labview, by itself, can’t speak to anything. It’s software. I assume you mean to use the FRC hardware (cRio) to communicate with the Mega? The trick then is to find the command block for data communications, address it to the correct port (I2C, Serial, etc) and then all you do is squirt your data in and listen for what comes out. Have to do that on the 'duino too.

There’s lots of info for the Arduino side of this; Google it.

Processing ( is sort of like the arduino’s computer-side counterpart. The languages are virtually the same, and there’s a wealth of information online about building interfaces with it, and communicating with the arduino either by serial, or (with an ethernet shield on the arduino) TCP/IP (standard networking protocol). Processing itself is java based, and cross platform, just like the arduino IDE.

I like your idea about using processing… i’l give that a try.
Thanks to both of you. :smiley:

There is also this:

Labview interface for Arduino.

I have not tried it yet, but it looks interesting.

Going off of this, you can also download an LV Interface for Arduino from VI Package Manager, a LabVIEW library management application to make adding other libraries/tools to LV easy. I’m not sure if the two are the same, but it’s at least worth looking into.

Thanks guys, I have it figured out.
Ill use processing and the Serial I/O library.

I’ve been looking into this same problem. We’d like to use Arduino’s to control our old robots rather than buying new cRIOs each year.

I’ve got all the aspects of using the Arduino to control all of our 2010 Breakaway robots functions. That part took a bit but now works well. I have attached a Joystick shield to my Arduino and can run the robot quite nicely.

Now I’ve got to figure out a way to interface the Arduino. I would PREFER to use either an Ethernet Shield attached to the robot modem, or using a WiFi Shield ($$$). Then comes the herculean task of figuring out how to receive the commands from the LabView Program on the drive station, interpret them in the Arduino, and run the robot. The good news is at least initially, all I need to do is make the connection from a laptop to the Arduino. If I can do that, I can use a variety of programs to make my own “drive station” and worry about the LV drive station interaction later.

If anyone has figured out how to make the Arduino “wireless” and allow it to accept commands from from a separate laptop?


For CARD (Collegiate Arial Robotics Demostration) Team #6, I developed what was supposed to be an FRC compatible Arduino “robot” and Driver Station.

We used the 2009-2010 wireless bridge, since we could “borrow” it from an FRC team, an Arduino Mega 2560 and an ethernet shield. The robot code unfortunatly is not compatible with the official driver station. This is due to the fact that the Arduino could not read the data from the shield fast enough. We used the FRC protocol, but had to reduce the user data sizes such that the total packet size was under 128 bytes, vs the FRC 1024 bytes.

We never tested the limits of the ethernet shield other than that it couldn’t do 1024 bytes/packet, but could do 192 bytes/packet. We shrank the packets to 128 bytes for saftey once we knew the size of our user data. We speculated that it would be possible to support the offical packet size, but it would require significant improvments to the Arduino ethernet library. We opted for the quicker option.

The driver station should be compatible with an FRC robot, but I never tested it with a real cRio.

If you try to use any of this, and have issues please contact me.

DISCLAIMER: This worked for us, but it is lacking some of the saftey features of the official cRio/DS. Some of the safties I left out were probably there for good reason. I take no responsiblity for anything you do with this code.

You can find the code from this project on Google Code. Search for “SCOE”.

I love your drivers station (and the fact that it works with arduino). I would like to know the guidelines that would allow me to retrieve the data packets that are sent from the DS to the arduino (using the native arduino language, if possible).

Just warning you… NOOB PROGRAMMER ALERT!!!
this is my first large scale project that I have done. Just bear with me and all of my stupid questions :smiley:

If anyone has figured out how to make the Arduino “wireless” and allow it to accept commands from from a separate laptop?

We discussed some of these concepts in a previous post…I have linked to the source code used to create several Arduino only control systems. Our versions use an Arduino and an Ethernet shield on each end to create a low cost control solution. The driver side Ardunio can be replaced with a laptop that interprets the joysticks if you prefer.

Arduino Wifi Control Source Code The code is linked at the bottom of the page.

The robot side code is simply interpreting signals sent from the driver side via wifi…and signals sent via wifi could be interpreted with some modifications.

thanks for the link to the code, this will be very helpful when writing my own version.
my only question as far as this code is where you got the PS/2 library and the network client library.

#include <Ethernet.h> (I already have this one)
#include <ClientUDP.h>(I need these two)
#include <PS2X_lib.h>

Am I correct to assume that you connected to the network using the ethernet shield?

ignore the hardware question in my last post :smiley:


Your code and setup is great and gives me great hope. Your comments go a long way toward explaining what’s happening. The problem is, I am just a beginner in Arduino programming and much of the code is still over my head. Could you be prevailed upon to provide some small tutorial as to what’s happening and “How things Work!”?


In the same vein. I am highly impressed with what you’ve done, but again, it’s well beyond where I am now and I desperately need to catch up. Anything you could do to explain not only how you got your information, but also what it means and how do I make use of it…would be GREAT!.

I find it very interesting, and highly encouraging that I’ve gotten a TON of good help from the FIRST oriented people here on Chief Delphi, but have been mostly ignored or ridiculed on the Arduino Forums. Must be the stuff we learn in FIRST works!

Thanks ALL,

Hey Garrett,

I worked with Anthony to develop the Arduino control system. Since we’ve released that source code, the official Arduino code has added in support for UDP packets. You no longer need a 3rd party library, but the code will have to be modified slightly. More on this below.

As far as the PS2X library, you can get it here:

Please let me know if you’re able to get this working, as I believe this is a new version of the library that we have yet to test.

I’ve gone ahead and released source code for a basic tank drive robot control system that uses an Arduino (I’d suggest an Ethernet Pro: or a Netduino (programmed in Visual Studio). I’ve released a free/open source Android app that you can use to control the Arduino or Netduino in addition to a Python app that will allow you to use a laptop as a driver station with any USB gamepad.

All the instructions and source code are located here: (my personal site) (google code project)

All of this code uses the latest Arduino version, so you should be able to get a basic system up and running without modifying anything. This works with the native Arduino Ethernet code to send UDP packets.

Hope this will get you off to a good start. I’m always available to answer questions, just shoot me a PM if you need any assistance. Good luck!