资源简介
c#控制stme32 驱动电机,同时还有红外线判断电机移动位置

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO.Ports;
namespace test_app
{
public partial class fish : Form
{
private SerialPort ComDevice = new SerialPort();
public fish()
{
InitializeComponent();
this.init();
}
public void init()
{
this.MaximizeBox = false;
this.MinimizeBox = false;
comboBox_COMList.Items.AddRange(SerialPort.GetPortNames());
if (comboBox_COMList.Items.Count > 0)
{
comboBox_COMList.SelectedIndex = 0;
}
comboBox_rate.SelectedIndex = 5;
comboBox_databit.SelectedIndex = 0;
comboBox_parity.SelectedIndex = 0;
comboBox_stopbit.SelectedIndex = 0;
//pictureBox1.BackgroundImage = Properties.Resources.red;
//ComDevice.DataReceived += new SerialDataReceivedEventHandler(Com_DataReceived);//绑定事件
}
private void btn_openCOM_Click(object sender EventArgs e)
{
if (comboBox_COMList.Items.Count <= 0)
{
MessageBox.Show(“没有发现串口请检查线路!“);
return;
}
if (ComDevice.IsOpen == false)
{
ComDevice.PortName = comboBox_COMList.SelectedItem.ToString();
ComDevice.BaudRate = Convert.ToInt32(comboBox_rate.SelectedItem.ToString());
ComDevice.Parity = (Parity)Convert.ToInt32(comboBox_parity.SelectedIndex.ToString());
ComDevice.DataBits = Convert.ToInt32(comboBox_databit.SelectedItem.ToString());
ComDevice.StopBits = (StopBits)Convert.ToInt32(comboBox_stopbit.SelectedItem.ToString());
try
{
ComDevice.Open();
//btnSend.Enabled = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message “错误“ MessageBoxButtons.OK MessageBoxIcon.Error);
return;
}
btn_openCOM.Text = “关闭串口“;
//pictureBox1.BackgroundImage = Properties.Resources.green;
}
else
{
try
{
ComDevice.Close();
//btnSend.Enabled = false;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message “错误“ MessageBoxButtons.OK MessageBoxIcon.Error);
}
btn_openCOM.Text = “打开串口“;
//pictureBox1.BackgroundImage = Properties.Resources.red;
}
comboBox_COM
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 142 2018-08-26 22:08 test_app\.vs\test_app\DesignTimeBuild\.dtbcache
..A..H. 52736 2018-11-14 22:20 test_app\.vs\test_app\v15\.suo
文件 0 2018-08-05 00:20 test_app\.vs\test_app\v15\Server\sqlite3\db.lock
文件 585728 2018-08-10 07:54 test_app\.vs\test_app\v15\Server\sqlite3\storage.ide
文件 32768 2018-11-05 22:00 test_app\.vs\test_app\v15\Server\sqlite3\storage.ide-shm
文件 4120032 2018-09-09 20:48 test_app\.vs\test_app\v15\Server\sqlite3\storage.ide-wal
文件 189 2018-08-05 00:19 test_app\test_app\App.config
文件 16384 2018-08-10 21:57 test_app\test_app\bin\Debug\test_app.exe
文件 189 2018-08-05 00:19 test_app\test_app\bin\Debug\test_app.exe.config
文件 26112 2018-08-10 21:57 test_app\test_app\bin\Debug\test_app.pdb
文件 35840 2018-09-08 10:30 test_app\test_app\bin\Release\Fishing.exe
文件 189 2018-08-05 00:19 test_app\test_app\bin\Release\Fishing.exe.config
文件 26112 2018-09-08 10:30 test_app\test_app\bin\Release\Fishing.pdb
文件 9662 2018-08-11 08:40 test_app\test_app\favicon-20180811083905493.ico
文件 7366 2018-09-08 10:30 test_app\test_app\Form1.cs
文件 18594 2018-09-08 10:30 test_app\test_app\Form1.Designer.cs
文件 20617 2018-09-08 10:30 test_app\test_app\Form1.resx
文件 1443 2018-08-05 21:06 test_app\test_app\obj\Debug\DesignTimeResolveAssemblyReferences.cache
文件 7156 2018-08-05 00:22 test_app\test_app\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 0 2018-08-05 00:19 test_app\test_app\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
文件 0 2018-08-05 00:19 test_app\test_app\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
文件 0 2018-08-05 00:19 test_app\test_app\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
文件 42 2018-08-10 21:49 test_app\test_app\obj\Debug\test_app.csproj.CoreCompileInputs.cache
文件 674 2018-08-10 21:49 test_app\test_app\obj\Debug\test_app.csproj.FileListAbsolute.txt
文件 1012 2018-08-10 21:57 test_app\test_app\obj\Debug\test_app.csproj.GenerateResource.cache
文件 16384 2018-08-10 21:57 test_app\test_app\obj\Debug\test_app.exe
文件 180 2018-08-10 21:57 test_app\test_app\obj\Debug\test_app.fish.resources
文件 26112 2018-08-10 21:57 test_app\test_app\obj\Debug\test_app.pdb
文件 180 2018-08-10 21:49 test_app\test_app\obj\Debug\test_app.Properties.Resources.resources
文件 1605 2018-09-02 17:19 test_app\test_app\obj\Release\DesignTimeResolveAssemblyReferences.cache
............此处省略44个文件信息
- 上一篇:C#实现写字板word
- 下一篇:c#高级计算器
相关资源
- C# TIP文件生成和拆解
- C#解析HL7消息的库135797
- C# OCR数字识别实例,采用TessnetOcr,对
- 考试管理系统 - C#源码
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
评论
共有 条评论