Click here to Skip to main content
16,007,885 members
Home / Discussions / C#
   

C#

 
GeneralRe: Communicating with an USB Device Pin
haolan3-Jan-08 9:15
haolan3-Jan-08 9:15 
GeneralRe: Communicating with an USB Device Pin
haolan3-Jan-08 9:56
haolan3-Jan-08 9:56 
GeneralRe: Communicating with an USB Device Pin
Dave Kreskowiak3-Jan-08 10:54
mveDave Kreskowiak3-Jan-08 10:54 
GeneralRe: Communicating with an USB Device Pin
Dave Kreskowiak3-Jan-08 10:46
mveDave Kreskowiak3-Jan-08 10:46 
GeneralRe: Communicating with an USB Device Pin
haolan3-Jan-08 22:21
haolan3-Jan-08 22:21 
GeneralRe: Communicating with an USB Device Pin
haolan3-Jan-08 22:18
haolan3-Jan-08 22:18 
GeneralRe: Communicating with an USB Device Pin
Dave Kreskowiak4-Jan-08 1:52
mveDave Kreskowiak4-Jan-08 1:52 
GeneralRe: Communicating with an USB Device Pin
haolan4-Jan-08 7:31
haolan4-Jan-08 7:31 
Ahh ok..

I connected the device again, and found out that if I run:

string[] ports = SerialPort.GetPortNames();
foreach (string p in ports)
{
Console.WriteLine(p);
}

It has created a new COM port named COM6. So i guess i should be able to communicate with my device through that port?

I have created the following code for communication:

SerialPort sp = new SerialPort("COM6", 1200, Parity.None, 8, StopBits.One);

try
{
sp.Open();
sp.Write("GET");
sp.ReadTimeout = 10000;
string ans = sp.ReadLine();
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
finally
{
sp.Close();
}

I get timeout when I am waiting for answer, but I guess it could be a mistake of how to communicate with the device.
GeneralRe: Communicating with an USB Device Pin
Dave Kreskowiak4-Jan-08 12:13
mveDave Kreskowiak4-Jan-08 12:13 
GeneralRe: Communicating with an USB Device Pin
haolan7-Jan-08 0:57
haolan7-Jan-08 0:57 
GeneralRe: Communicating with an USB Device Pin
Dave Kreskowiak7-Jan-08 3:08
mveDave Kreskowiak7-Jan-08 3:08 
GeneralRe: Communicating with an USB Device Pin
haolan9-Jan-08 3:40
haolan9-Jan-08 3:40 
GeneralRe: Communicating with an USB Device Pin
Dave Kreskowiak9-Jan-08 17:00
mveDave Kreskowiak9-Jan-08 17:00 
GeneralRe: Communicating with an USB Device Pin
haolan10-Jan-08 12:39
haolan10-Jan-08 12:39 
GeneralRe: Communicating with an USB Device Pin
Dave Kreskowiak10-Jan-08 13:19
mveDave Kreskowiak10-Jan-08 13:19 
GeneralRe: Communicating with an USB Device Pin
haolan10-Jan-08 14:09
haolan10-Jan-08 14:09 
GeneralRe: Communicating with an USB Device Pin
Mircea Puiu3-Jan-08 6:39
Mircea Puiu3-Jan-08 6:39 
Generalinheriting from a class and also using a constraint Pin
bwilhite3-Jan-08 4:25
bwilhite3-Jan-08 4:25 
GeneralRe: inheriting from a class and also using a constraint Pin
Pete O'Hanlon3-Jan-08 4:41
mvePete O'Hanlon3-Jan-08 4:41 
GeneralRe: inheriting from a class and also using a constraint Pin
bwilhite3-Jan-08 4:48
bwilhite3-Jan-08 4:48 
GeneralRe: inheriting from a class and also using a constraint Pin
Tim Paaschen3-Jan-08 5:57
Tim Paaschen3-Jan-08 5:57 
GeneralRe: inheriting from a class and also using a constraint Pin
bwilhite3-Jan-08 6:13
bwilhite3-Jan-08 6:13 
Generalstring value in url Pin
eyeseetee3-Jan-08 4:13
eyeseetee3-Jan-08 4:13 
GeneralRe: string value in url Pin
Not Active3-Jan-08 4:50
mentorNot Active3-Jan-08 4:50 
QuestionAdding a RichTextBox to a Tab Page Pin
Programm3r3-Jan-08 4:07
Programm3r3-Jan-08 4:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.