I have managed to identify both drives and serial ports in visual C# express but I still cannot access a specific device (RepRap Printer). I would like to send an array of string to it but first I need to locate it, how can I do that? I am using windows 7.
To get the drives:
using System.Linq;
using System.IO;
using System;
class Program
{
static void Main(string[] args)
{
var drives = DriveInfo.GetDrives();
DriveInfo[] allDrives = DriveInfo.GetDrives();
foreach(DriveInfo dv in drives)
{
Console.WriteLine("drive Name:{0}", dv.Name);
}
Console.ReadLine();
}
}
to get the serial ports:
using System;
using System.IO.Ports;
namespace SerialPortExample
{
class SerialPortExample
{
public static void Main()
{
string[] ports = SerialPort.GetPortNames();
Console.WriteLine("The following serial ports were found:");
foreach (string port in ports)
{
Console.WriteLine(port);
}
Console.ReadLine();
}
}
}
Many thanks in advance!