Question

I tried to send commands to a GSM modem or phone with C# using this code but it`s not working! Can anybody tell me what should I do ?

SerialPort sp = new SerialPort();
sp.PortName = "COM42";
sp.Open();
sp.Write("ATD09364191752");
Was it helpful?

Solution

  1. You are not writing a newline after the ATD command. (I think you have to.)
  2. You don't call sp.Flush(), so the command may be getting stuck in a buffer. Try adding this call after the Write() call.

OTHER TIPS

You are relying on all default settings for baud-rate, handshake protocols etc. You may want to check the modem docs about those.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top