指纹集成软件开发
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.Timers;
namespace fingerprinttest
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
SerialPort sp = new SerialPort(); //声明一个串口类
private void button1_Click(object sender, EventArgs e)
{
sp.Close();
sp = new SerialPort();
sp.PortName = comboBox1.Text;
sp.BaudRate = 57600;
sp.Open();//打开串口
}
private void button2_Click(object sender, EventArgs e)
{
sp.WriteLine(textBox1.Text);//往串口写数据
}
}
}