This topic explains the minimum steps that are necessary for creating a program that uses the Rhyduino library to establish communications with an Arduino device.
I am assuming that you have already done the following (or equivalent):
The central object in the Rhyduino library is the Arduino class. Everything starts there.
For the first example I will show you the simplest possible way to create an instance of this class and associate it with your physical Arduino.
As you can see on line 1, I have chosen to import the Rhyduino namespace with a using statement. It's a matter of personal preference. You choose not to, you'll just have to use fully-qualified object names (i.e. “Rhyduino.Arduino” instead of “Arduino”).
The next thing you'll notice is that I've placed the Arduino constructor call inside a using block. The Dispose() method should always be called when you're done using an instance of the Arduino object; putting it in a using block makes sure that it's called automatically when the object goes out of scope. I often forget to dispose of objects when I'm done with them, so this saves me (and you) the headache.
There is no default constructor for the Arduino class. At a minimum, you need to specify the COM port that the Arduino is physically connected to. If you are unsure which COM port the Arduino is using, you can use Windows Device Manager to identify the connected device.
The code shown above doesn't actually open a connection to the device immediately. Instead it opens the connection the first time you attempt to use it to perform an operation that requires a connection. Additionally, it assumes that you will be communicating with the device at the default baud rate of 57,600 baud. This is the value that is used in the StandardFirmata.pde sketch. The same value needs to be used in both places, so if you would like to communicate at a different speed you will need to modify the Arduino sketch directly to reflect the change.
The following example builds on the previous example by showing you how to specify an alternate baud rate and override the delayed opening of the connection.
The advantage of opening the connection as part of the constructor is that you will be notified immediately (via an exception) if Rhyduino is unable to connect to the Arduino.
That's all there is to it. If you encounter problems, post them on one of our discussion lists or in the issue tracker. I want to hear about it so I can help you and/or fix the problem.