学习C Sharp主要的目的就是为了给项目做一个PC端的界面,并且通过串口和所用的CC2430之间通信。
C#里面的串口类非常好用,这里就不详细说了。。
下面是接收端的事件
private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
{
FileStream Save = new FileStream(@"E:/received.dat", FileMode.Append, FileAccess.Write);
Byte[] array = new byte[1024];
int count = serialPort1.BytesToRead;
serialPort1.Read(array, 0, count);
&nb

本文介绍如何使用C#的SerialPort类进行图片文件的发送与接收。在接收端,通过DataReceived事件监听串口数据,将接收到的字节写入文件;在发送端,读取图片文件并分批通过串口发送。代码中展示了同步操作的实现,但异步方式未涉及。
最低0.47元/天 解锁文章
1870

被折叠的 条评论
为什么被折叠?



