Question

I am enjoying programming in Visual Studio 2012 Express with the C# language, and have purchased an Arduino Uno.

I have read a couple of tutorials on how to get Visual Studio to work the Uno directly, but ones like this article have lines in it such as:

serialPort1.PortName = "COM4"
serialPort1.BaudRate = 9600;

When I am putting them into my test application, I am using the System.IO.Ports; but the serialPort1 does not recognise. Even when I make it a String value, then the PortName and BaudRate come up in the red.

Has anyone got a clear and detailed tutorial I can follow to get my "blink" test working on the board, or know how to fix the above please?

Était-ce utile?

La solution

serialPort1 is most likely an instance of the SerialPort class. You'll have to make one of your own. For instance, you could write the following line of code to create an instance with the settings you want:

var port = new SerialPort("COM4", 9600);

You can find more information about the class here.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top