Interfacing with Arduino from C# - Multithreaded Example Project.

I’ve recently started playing with my Arduino and put together this C# Windows project in Visual Studio 2010 to drive and test the device.

The project demonstrates how to use C# to communicate with the Arduino via a seperate thread in order to not block the main form.

In addition to illustrating how to interface with the Arduino from a C# program, it demonstrates the ability for using multiple threads to :
1.) Asynchronously buffer serial output to the Arduino so as to not block the windows form during transmission
2.) Create another, seperate thread for “driving load” or sending random RGB values to the Arduino.

The Arduino software and hardware setup are extremely simple, please run the app for detailed config. Essentially, it combines these configurations to change the power of the RGB LEDs as a result of interaction with the Windows FORM. The LCD, though not required, is interesting for showing the input from the Windows program to the Arduino

http://www.arduino.cc/en/Tutorial/LiquidCrystal

zipfile attached. Also available here:
https://skydrive.live.com/redir.aspx?cid=512082f83734c3b6&resid=512082F83734C3B6!3764&parid=512082F83734C3B6!3763

Let me know what you think.

By the way…

I wrote my own serial port interface, but later found this, which is a more robust implementation.
SerialPort (RS-232 Serial COM Port) in C# .NET : http://msmvps.com/blogs/coad/archive/2005/03/23/SerialPort-2800_RS_2D00_232-Serial-COM-Port_2900-in-C_2300_-.NET.aspx

CSharpArduinoDriver.zip (731 KB)

file error vs c# 2012. you try vs c# 2010