i have this code:
private SerialPort port = new SerialPort("COM1", 115200, Parity.None, 8, StopBits.One);
Console.WriteLine("Incoming Data:");
port.WriteTimeout = 5000;
port.ReadTimeout = 5000;
// Attach a method to be called when there is data waiting in the port's buffer
port.DataReceived += new SerialDataReceivedEventHandler(port_DataReceived);
// Begin communications
port.Open();
#region PhoneSMSSetup
port.Write("AT+CMGF=1\r\n");
Thread.Sleep(500);
port.Write("AT+CNMI=2,2\r\n");
Thread.Sleep(500);
port.Write("AT+CSCA=\"+4790002100\"\r\n");
Thread.Sleep(500);
#endregion
// Enter an application loop which keeps this thread alive
Application.Run();
i got it from here:
http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_22832563.html
i have a new winforms empty application:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
can you please tell me:
- where exactly would i paste the code?
- how do i get the code to run?
i am sending AT COMMANDS to my cell phone that is attached to the computer