本文介绍了我们如何阅读我们从arduino中提取的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们想要做的是当arduino将信号发送到我们正在制作的C#应用程序时,当arduino发送A信号时,会出现一个通知弹出窗口,如果它没有发送,通知框将不会出现。
我尝试了什么:
{
public partial class Form1:表格
{
public Form1()
{
InitializeComponent();
serialPort1.Open();
}
private void serialPort1_DataReceived( object sender,System.IO.Ports.SerialDataReceivedEventArgs e)
{
if ( serialPort1.Read( A));
{Notification.Enabled = true ; }
else
{Notification.Enabled = false ; }
}
私有 void Notification_Click( object sender,EventArgs e)
{
PopupNotifier popup = new PopupNotifier();
popup.Image = Properties.Resources.info;
popup.TitleText = Alert;
popup.ContentText = 嘿嘿;
popup.Popup();
}
}
}
解决方案
What we want to do is when the arduino will send a signal to the C# app that we are making and when the arduino sent the A signal, a notification popup should appear, if it did not send, the notification box will not appear.
What I have tried:
{ public partial class Form1 : Form { public Form1() { InitializeComponent(); serialPort1.Open(); } private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e) { if (serialPort1.Read("A")) ; { Notification.Enabled = true; } else { Notification.Enabled = false; } } private void Notification_Click(object sender, EventArgs e) { PopupNotifier popup = new PopupNotifier(); popup.Image = Properties.Resources.info; popup.TitleText = "Alert"; popup.ContentText = "Hey"; popup.Popup(); } } }
解决方案
这篇关于我们如何阅读我们从arduino中提取的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!