尝试使用gsm调制解调器发送

尝试使用gsm调制解调器发送

本文介绍了尝试使用gsm调制解调器发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因为我仍然对C#还是陌生的,所以编程的人可以请我帮助我不回信

as i am still new to c# and Programming could anybody please help me im not getting the message back

SerialPort  sp = new SerialPort("COM9", 115200, Parity.None, 8, StopBits.One);
               if (sp.IsOpen)
                   sp.Close();
                if (!sp.IsOpen)
                   sp.Open();

                sp.WriteLine("AT+CMGF=1" + Environment.NewLine);
                Console.WriteLine("AT+CMGF=1" + Environment.NewLine);
                sp.ReadLine();
                sp.WriteLine("AT+CMGS=" + (char)34 + textBox1.Text + (char)34 + Environment.NewLine);
                Console.WriteLine("AT+CMGS=" + (char)34 + textBox1.Text + (char)34 + Environment.NewLine);
                sp.WriteLine((char)34+textBox2.Text+(char)34 + Environment.NewLine );
                Console.WriteLine((char)34 + textBox2.Text + (char)34 + Environment.NewLine);
                sp.Close();

推荐答案


SerialPort  sp = new SerialPort("COM9", 115200, Parity.None, 8, StopBits.One);
               if (sp.IsOpen)
                   sp.Close();
                if (!sp.IsOpen)
                   sp.Open();

                sp.WriteLine("AT+CMGF=1" + Environment.NewLine);
                Console.WriteLine("AT+CMGF=1" + Environment.NewLine);
                sp.ReadLine();
                sp.WriteLine("AT+CMGS=" + (char)34 + textBox1.Text + (char)34 + Environment.NewLine);
                Console.WriteLine("AT+CMGS=" + (char)34 + textBox1.Text + (char)34 + Environment.NewLine);
                sp.WriteLine((char)34+textBox2.Text+(char)34+(char)26 + Environment.NewLine );
                Console.WriteLine((char)34 + textBox2.Text + (char)34 +(char)26+ Environment.NewLine);
                sp.Close();


这篇关于尝试使用gsm调制解调器发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-03 16:55