Although it's just work in progress I uploaded the complete VB.Net 2005 project here:http://www.gyps.nl/arduino/Arduino_Net.zip
This project is not a finished and polished one.
There is one test application in there that I used to test the inputs and outputs. The application works and I included a small text file with the Arduino connections I used.
All the functions in the class are documented, so using the class shouldn't be difficult.
Some explanation here:
To use the digital ports, you have to set the direction of the port (input, output or pwm), enable the port and optionally set a trigger.
When the trigger is set on a digital port, the class fires an event every time the value of that port is changed.
To read a button, attach that button to a digital port, set the direction to input, enable the port and enable the trigger.
When you push the button, an event is fired from the class, saying that the value is changed to 1 and when you release the button, an event is fired saying that the value has changed to 0.
It's also possible to read the current value of a digital port. This function will not give the current value in return, instead it fires the same event as if the trigger was used. This value-read function can be used with or without the use of the trigger.
For an analog port there's only input, so no direction to set here. Just enable the analog port and read the value.
There is also a 'trigger' on the analog port called threshold. This will fire an event when the value of the analog input is changed by more than the set threshold. This will eliminate the slight changes that occur on the analog input.
Reading the value of the analog input works the same as on the digital input. Just use the GetAnalogValue command and wait for the event.
I know it would be more easy if the value reading functions would return a value but this conflict with the working of the Arduino code.
I'm working on that.
Keep in mind that this is no finished product.
There are no real checks on the input values and portnumbers.
These are all to be implemented in the .Net class.
StartCommunication() As Boolean
SetDigitalDirection(ByVal Port As Integer, ByVal Direction As DigitalDirection)
SetDigitalValue(ByVal Port As Integer, ByVal Value As Integer)
EnableDigitalPort(ByVal Port As Integer, ByVal Enable As Boolean)
EnableAnalogPort(ByVal Port As Integer, ByVal Enable As Boolean)
EnableDigitalTrigger(ByVal Port As Integer, ByVal Enable As Boolean)
EnableAnalogTrigger(ByVal Port As Integer, ByVal Threshold As Integer)
GetDigitalValue(ByVal Port As Integer)
GetAnalogValue(ByVal Port As Integer)
DigitalDataReceived(ByVal DPortNr As Integer, ByVal Value As Integer)
AnalogDataReceived(ByVal APortNr As Integer, ByVal Value As Integer)
LogMessageReceived(ByVal Message As String, ByVal DebugLevel As Integer)
comments are welcome as always.