如何重置我的Arduino Mega2560与我的C#应用​​程序? [英] How do I reset my Arduino Mega2560 with my C# application?

查看:894
本文介绍了如何重置我的Arduino Mega2560与我的C#应用​​程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到Arduino的IDE自动在启动/退出复位内置串行应用,由于

I noticed the Arduino IDE automatically resets on startup/exit by the built in serial application due to

FT232RL的硬件流控制线(DTR)中的一个连接到经由100纳法电容器ATmega1280的复位线。当这条线被置(取低),复位线降到足够长的复位芯片。

one of the hardware flow control lines (DTR) of the FT232RL is connected to the reset line of the ATmega1280 via a 100 nanofarad capacitor. When this line is asserted (taken low), the reset line drops long enough to reset the chip.

我注意到的行为不符合我的序列C#应用程序发生。我想重置功能与我的C#应用​​程序的工作。什么我没有做让我的Arduino米加我的C#应用​​程序重置?

I noticed that behaviour does not happen with my serial C# application. I would like the reset feature to work with my C# application. What am I not doing to get my Arduino Mega to reset by my C# application?

工作code代表的Arduino和C#:

我把它从PWM Port12电线钩住到RESET港约5分钟的工作。 Arduino上,我检查对传入的SerialEvent3文本RESET。当RESET发现做的:

I got it working in about 5 minutes by hooking up a wire from PWM Port12 to the RESET Port. On the Arduino, I checked for the text RESET on the incoming SerialEvent3. When RESET is found do:

pinMode(7, OUTPUT);  
digitalWrite(7, LOW);

至于为C#这是简单的:

As for as the C# it was as simple as:

if (serialPort1.IsOpen)
{ 
    serialPort1.Write("RESET"); 
}

复位似乎按预期方式工作。

Reset seems to work as expected.

推荐答案

DTR工作正常,我从.NET SerialPort类。

DTR works fine for me from the .NET SerialPort class.

刚刚成立的属性:

port.DtrEnable = true;

我已经注意到不同的默认值,如果你在的WinForms设计师使用的SerialPort,但 DtrEnable 其实是在真正从一个控制台应用程序使用时(默认情况下)。

I have noticed different defaults if you use the SerialPort in the WinForms designer, but DtrEnable is in fact true (by default) when using it from a console app.

这篇关于如何重置我的Arduino Mega2560与我的C#应用​​程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆