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;
using System.IO.Ports;
using System.Threading;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
SerialPort SP = new SerialPort("COM35");
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
SP.BaudRate = 9600;
SP.Parity = Parity.None;
SP.DataBits = 8;
SP.StopBits = StopBits.One;
SP.RtsEnable = true;
SP.DtrEnable = true;
SP.Encoding.GetEncoder();
SP.ReceivedBytesThreshold = 1;
SP.NewLine = Environment.NewLine;
try
{
SP.Open();
SP.Write((e.KeyChar).ToString());
Thread.Sleep(10);
SP.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}
THANK YOU FOR VISITING..!!
PLEASE COMMENT
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;
using System.Threading;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
SerialPort SP = new SerialPort("COM35");
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
SP.BaudRate = 9600;
SP.Parity = Parity.None;
SP.DataBits = 8;
SP.StopBits = StopBits.One;
SP.RtsEnable = true;
SP.DtrEnable = true;
SP.Encoding.GetEncoder();
SP.ReceivedBytesThreshold = 1;
SP.NewLine = Environment.NewLine;
try
{
SP.Open();
SP.Write((e.KeyChar).ToString());
Thread.Sleep(10);
SP.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}
THANK YOU FOR VISITING..!!
PLEASE COMMENT
No comments:
Post a Comment