0
  • 聊天消息
  • 系统消息
  • 评论与回复
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
会员中心
创作中心

完善资料让更多小伙伴认识你,还能领取20积分哦,立即完善>

3天内不再提示

怎样在C#中检测手势并控制IoT

454398 来源:wv 2019-10-13 17:24 次阅读

步骤1:您需要的内容:

怎样在C#中检测手势并控制IoT

硬件

LattePanda(您可以

屏幕和触摸面板

软件

Arduino IDE

Visual Studio

步骤2:演示1:检测鼠标位置并单击事件

让我们执行项目步骤一步一步首先,请尝试检测是否按下了鼠标。因此,我们可以根据间隔来检测双击和三次单击。

这是一个简单的Windows Form应用程序。文本框将显示鼠标的X轴和Y轴。 您可以在PC上播放此演示。

操作方法播放演示1:

运行.exe并移动鼠标,软件将自动检测鼠标的位置。如果按下鼠标左键,文本框将显示该事件。

您可以在下面查看代码或在此处下载演示。如果要自己制作此演示,则需要在此处下载Visual Studio。 Open.sln文件,然后可以将其设置为自己的文件。

演示1代码:

using System;

using System.Drawing;

using System.Windows.Forms;

using System.Runtime.InteropServices;

namespace Demo_mousehook_csdn

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

MouseHook mh;

private void Form1_Load(object sender, EventArgs e)

{

mh = new MouseHook();

mh.SetHook();

mh.MouseMoveEvent += mh_MouseMoveEvent;

mh.MouseClickEvent += mh_MouseClickEvent;

mh.MouseDownEvent += mh_MouseDownEvent;

mh.MouseUpEvent += mh_MouseUpEvent;

}

private void mh_MouseDownEvent(object sender, MouseEventArgs e)

{

if (e.Button == MouseButtons.Left)

{

richTextBox1.AppendText(“Left Button Press ”);

}

if (e.Button == MouseButtons.Right)

{

richTextBox1.AppendText(“Right Button Press ”);

}

}

private void mh_MouseUpEvent(object sender, MouseEventArgs e)

{

if (e.Button == MouseButtons.Left)

{

richTextBox1.AppendText(“Left Button Release ”);

}

if (e.Button == MouseButtons.Right)

{

richTextBox1.AppendText(“Right Button Release ”);

}

}

private void mh_MouseClickEvent(object sender, MouseEventArgs e)

{

//MessageBox.Show(e.X + “-” + e.Y);

if (e.Button == MouseButtons.Left)

{

string sText = “(” + e.X.ToString() + “,” + e.Y.ToString() + “)”;

label1.Text = sText;

}

}

private void mh_MouseMoveEvent(object sender, MouseEventArgs e)

{

int x = e.Location.X;

int y = e.Location.Y;

textBox1.Text = x + “”;

textBox2.Text = y + “”;

}

private void Form1_FormClosed(object sender, FormClosedEventArgs e)

{

mh.UnHook();

}

private void Form1_FormClosed_1(object sender, FormClosedEventArgs e)

{

mh.UnHook();

}

private void richTextBox1_TextChanged(object sender, EventArgs e)

{

}

}

public class Win32Api

{

[StructLayout(LayoutKind.Sequential)]

public class POINT

{

public int x;

public int y;

}

[StructLayout(LayoutKind.Sequential)]

public class MouseHookStruct

{

public POINT pt;

public int hwnd;

public int wHitTestCode;

public int dwExtraInfo;

}

public delegate int HookProc(int nCode, IntPtr wParam, IntPtr lParam);

[DllImport(“user32.dll”, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]

public static extern int SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, int threadId);

[DllImport(“user32.dll”, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]

public static extern bool UnhookWindowsHookEx(int idHook);

[DllImport(“user32.dll”, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]

public static extern int CallNextHookEx(int idHook, int nCode, IntPtr wParam, IntPtr lParam);

}

public class MouseHook

{

private Point point;

private Point Point

{

get { return point; }

set

{

if (point != value)

{

point = value;

if (MouseMoveEvent != null)

{

var e = new MouseEventArgs(MouseButtons.None, 0, point.X, point.Y, 0);

MouseMoveEvent(this, e);

}

}

}

}

private int hHook;

private const int WM_MOUSEMOVE = 0x200;

private const int WM_LBUTTONDOWN = 0x201;

private const int WM_RBUTTONDOWN = 0x204;

private const int WM_MBUTTONDOWN = 0x207;

private const int WM_LBUTTONUP = 0x202;

private const int WM_RBUTTONUP = 0x205;

private const int WM_MBUTTONUP = 0x208;

private const int WM_LBUTTONDBLCLK = 0x203;

private const int WM_RBUTTONDBLCLK = 0x206;

private const int WM_MBUTTONDBLCLK = 0x209;

public const int WH_MOUSE_LL = 14;

public Win32Api.HookProc hProc;

public MouseHook()

{

this.Point = new Point();

}

public int SetHook()

{

hProc = new Win32Api.HookProc(MouseHookProc);

hHook = Win32Api.SetWindowsHookEx(WH_MOUSE_LL, hProc, IntPtr.Zero, 0);

return hHook;

}

public void UnHook()

{

Win32Api.UnhookWindowsHookEx(hHook);

}

private int MouseHookProc(int nCode, IntPtr wParam, IntPtr lParam)

{

Win32Api.MouseHookStruct MyMouseHookStruct = (Win32Api.MouseHookStruct)Marshal.PtrToStructure(lParam, typeof(Win32Api.MouseHookStruct));

if (nCode 《 0)

{

return Win32Api.CallNextHookEx(hHook, nCode, wParam, lParam);

}

else

{

if (MouseClickEvent != null)

{

MouseButtons button = MouseButtons.None;

int clickCount = 0;

switch ((Int32)wParam)

{

case WM_LBUTTONDOWN:

button = MouseButtons.Left;

clickCount = 1;

MouseDownEvent(this, new MouseEventArgs(button, clickCount, point.X, point.Y, 0));

break;

case WM_RBUTTONDOWN:

button = MouseButtons.Right;

clickCount = 1;

MouseDownEvent(this, new MouseEventArgs(button, clickCount, point.X, point.Y, 0));

break;

case WM_MBUTTONDOWN:

button = MouseButtons.Middle;

clickCount = 1;

MouseDownEvent(this, new MouseEventArgs(button, clickCount, point.X, point.Y, 0));

break;

case WM_LBUTTONUP:

button = MouseButtons.Left;

clickCount = 1;

MouseUpEvent(this, new MouseEventArgs(button, clickCount, point.X, point.Y, 0));

break;

case WM_RBUTTONUP:

button = MouseButtons.Right;

clickCount = 1;

MouseUpEvent(this, new MouseEventArgs(button, clickCount, point.X, point.Y, 0));

break;

case WM_MBUTTONUP:

button = MouseButtons.Middle;

clickCount = 1;

MouseUpEvent(this, new MouseEventArgs(button, clickCount, point.X, point.Y, 0));

break;

}

var e = new MouseEventArgs(button, clickCount, point.X, point.Y, 0);

MouseClickEvent(this, e);

}

this.Point = new Point(MyMouseHookStruct.pt.x, MyMouseHookStruct.pt.y);

return Win32Api.CallNextHookEx(hHook, nCode, wParam, lParam);

}

}

public delegate void MouseMoveHandler(object sender, MouseEventArgs e);

public event MouseMoveHandler MouseMoveEvent;

public delegate void MouseClickHandler(object sender, MouseEventArgs e);

public event MouseClickHandler MouseClickEvent;

public delegate void MouseDownHandler(object sender, MouseEventArgs e);

public event MouseDownHandler MouseDownEvent;

public delegate void MouseUpHandler(object sender, MouseEventArgs e);

public event MouseUpHandler MouseUpEvent;

}

}

如果有任何疑问,请让我知道!

步骤3:演示2:检测双击并控制LED

请参见上图。为了防止错误触发,我在屏幕区域的右1/5处设置了检测鼠标双击的功能。

在此演示中,您将知道如何检测双击(只需计算两次单击的间隔)并通过Arduino Leonardo控制LED。

此演示涉及C#和Arduino串行通信(PC与Arduino之间的通信)。如果您想了解这部分知识,请参见此处的教程

如何播放演示2:

双击右侧1/5侧面屏幕上的,然后您将进入GPIO控制模式,LED将会点亮。单击屏幕左侧的4/5侧,LED将关闭。

您可以在附件中查看代码或在此处下载演示。如果最小化窗口,则该功能仍然有效。很酷,不是吗?

演示2代码:

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.Runtime.InteropServices;

using System.Globalization;

using LattePanda.Firmata;

namespace Demo_mousehook_csdn

{

public partial class Form1 : Form

{

static Arduino arduino = new Arduino();

static DateTime localDate = DateTime.Now;

double click_time;

int click_count = 0;

bool tri_click_flag = false;

public Form1()

{

InitializeComponent();

arduino.pinMode(13, Arduino.OUTPUT);//

}

MouseHook mh;

private void Form1_Load(object sender, EventArgs e)

{

mh = new MouseHook();

mh.SetHook();

mh.MouseMoveEvent += mh_MouseMoveEvent;

mh.MouseClickEvent += mh_MouseClickEvent;

}

private void mh_MouseClickEvent(object sender, MouseEventArgs e)

{

//MessageBox.Show(e.X + “-” + e.Y);

if (e.Button == MouseButtons.Left)

{

string sText = “(” + e.X.ToString() + “,” + e.Y.ToString() + “)”;

label1.Text = sText;

click_time = (DateTime.Now - localDate).TotalSeconds;

localDate = DateTime.Now;

if (e.X 》 (Screen.PrimaryScreen.Bounds.Width / 5 * 4))

{

if (click_time 《= 0.5)

{

click_count += 1;

if (click_count 》 0)

{

click_count = 1;

tri_click_flag = true;

}

else

{

tri_click_flag = false;

}

}

else

{

}

if (click_count 《=1 && click_time 》 0.5)

click_count = 0;

}

else

{

click_count = 0;

tri_click_flag = false;

}

if (tri_click_flag == true)

{

textBox6.Text = “1”;

arduino.digitalWrite(13, Arduino.HIGH);

}

else

{

textBox6.Text = “0”;

arduino.digitalWrite(13, Arduino.LOW);

}

}

}

private void mh_MouseMoveEvent(object sender, MouseEventArgs e)

{

int x = e.Location.X;

int y = e.Location.Y;

textBox1.Text = x + “”;

textBox2.Text = y + “”;

textBox3.Text = Screen.PrimaryScreen.Bounds.Height.ToString();

textBox4.Text = Screen.PrimaryScreen.Bounds.Width.ToString();

}

private void Form1_FormClosed(object sender, FormClosedEventArgs e)

{

mh.UnHook();

}

private void Form1_FormClosed_1(object sender, FormClosedEventArgs e)

{

mh.UnHook();

}

private void textBox1_TextChanged(object sender, EventArgs e)

{

}

private void textBox2_TextChanged(object sender, EventArgs e)

{

}

private void label1_Click(object sender, EventArgs e)

{

}

private void textBox3_TextChanged(object sender, EventArgs e)

{

}

private void textBox4_TextChanged(object sender, EventArgs e)

{

}

private void label2_Click(object sender, EventArgs e)

{

}

private void label3_Click(object sender, EventArgs e)

{

}

private void textBox5_TextChanged(object sender, EventArgs e)

{

}

private void textBox6_TextChanged(object sender, EventArgs e)

{

}

}

public class Win32Api

{

[StructLayout(LayoutKind.Sequential)]

public class POINT

{

public int x;

public int y;

}

[StructLayout(LayoutKind.Sequential)]

public class MouseHookStruct

{

public POINT pt;

public int hwnd;

public int wHitTestCode;

public int dwExtraInfo;

}

public delegate int HookProc(int nCode, IntPtr wParam, IntPtr lParam);

//安装钩子

[DllImport(“user32.dll”, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]

public static extern int SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, int threadId);

//卸载钩子

[DllImport(“user32.dll”, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]

public static extern bool UnhookWindowsHookEx(int idHook);

//调用下一个钩子

[DllImport(“user32.dll”, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]

public static extern int CallNextHookEx(int idHook, int nCode, IntPtr wParam, IntPtr lParam);

}

public class MouseHook

{

private Point point;

private Point Point

{

get { return point; }

set

{

if (point != value)

{

point = value;

if (MouseMoveEvent != null)

{

var e = new MouseEventArgs(MouseButtons.None, 0, point.X, point.Y, 0);

MouseMoveEvent(this, e);

}

}

}

}

private int hHook;

private const int WM_LBUTTONDOWN = 0x201;

public const int WH_MOUSE_LL = 14;

public Win32Api.HookProc hProc;

public MouseHook()

{

this.Point = new Point();

}

public int SetHook()

{

hProc = new Win32Api.HookProc(MouseHookProc);

hHook = Win32Api.SetWindowsHookEx(WH_MOUSE_LL, hProc, IntPtr.Zero, 0);

return hHook;

}

public void UnHook()

{

Win32Api.UnhookWindowsHookEx(hHook);

}

private int MouseHookProc(int nCode, IntPtr wParam, IntPtr lParam)

{

Win32Api.MouseHookStruct MyMouseHookStruct = (Win32Api.MouseHookStruct)Marshal.PtrToStructure(lParam, typeof(Win32Api.MouseHookStruct));

if (nCode 《 0)

{

return Win32Api.CallNextHookEx(hHook, nCode, wParam, lParam);

}

else

{

if (MouseClickEvent != null)

{

MouseButtons button = MouseButtons.None;

int clickCount = 0;

switch ((Int32)wParam)

{

case WM_LBUTTONDOWN:

button = MouseButtons.Left;

clickCount = 1;

break;

}

var e = new MouseEventArgs(button, clickCount, point.X, point.Y, 0);

MouseClickEvent(this, e);

}

this.Point = new Point(MyMouseHookStruct.pt.x, MyMouseHookStruct.pt.y);

return Win32Api.CallNextHookEx(hHook, nCode, wParam, lParam);

}

}

public delegate void MouseMoveHandler(object sender, MouseEventArgs e);

public event MouseMoveHandler MouseMoveEvent;

public delegate void MouseClickHandler(object sender, MouseEventArgs e);

public event MouseClickHandler MouseClickEvent;

}

}

这是一种进行交互项目的新方法。它也可以用于家庭自动化控制系统。使用PC来控制空调,灯光,电视等。

步骤4:演示3:检测三次单击并控制屏幕背景光

在此演示中,您将获得鼠标的位置并将实时值发送到PC。然后,您的PC可以根据该值更改背景光。 您还可以在PC上播放此演示。

此演示涉及使用C#来控制屏幕的背景光。如果您想了解这一部分知识,可以在这里查看教程。

如何播放演示3:

在右侧1/3上单击三次。屏幕的5侧,然后您将进入GPIO控制模式,向上或向下移动手指,屏幕的背景光会变暗或变暗。

此功能与您的iPhone有点相似。您可以在附件中查看代码或在此处下载演示。

方法1:

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.Runtime.InteropServices;

using System.Globalization;

namespace Demo_mousehook_csdn

{

public partial class Form1 : Form

{

[DllImport(“gdi32.dll”)]

private unsafe static extern bool SetDeviceGammaRamp(Int32 hdc, void* ramp);

private static bool initialized = false;

private static Int32 hdc;

private static int a;

static DateTime localDate = DateTime.Now;

double click_time;

int click_count = 0;

bool tri_click_flag = false;

static string sText=“”;

static int IncreaseData = 0;

static int ClickPositionY = 0;

public Form1()

{

InitializeComponent();

}

MouseHook mh;

// protected override void SetVisibleCore(bool value)

// {

// base.SetVisibleCore(false);

// }

private void Form1_Load(object sender, EventArgs e)

{

mh = new MouseHook();

mh.SetHook();

mh.MouseMoveEvent += mh_MouseMoveEvent;

mh.MouseClickEvent += mh_MouseClickEvent;

mh.MouseDownEvent += mh_MouseDownEvent;

mh.MouseUpEvent += mh_MouseUpEvent;

}

private static void InitializeClass()

{

if (initialized)

return;

//Get the hardware device context of the screen, we can do

//this by getting the graphics object of null (IntPtr.Zero)

//then getting the HDC and converting that to an Int32.

hdc = Graphics.FromHwnd(IntPtr.Zero).GetHdc().ToInt32();

initialized = false;

}

public static unsafe bool SetBrightness(int brightness)

{

InitializeClass();

if (brightness 》 255)

brightness = 255;

if (brightness 《 0)

brightness = 0;

short* gArray = stackalloc short[3 * 256];

short* idx = gArray;

for (int j = 0; j 《 3; j++)

{

for (int i = 0; i 《 256; i++)

{

int arrayVal = i * (brightness + 128);

if (arrayVal 》 65535)

arrayVal = 65535;

*idx = (short)arrayVal;

idx++;

}

}

//For some reason, this always returns false?

bool retVal = SetDeviceGammaRamp(hdc, gArray);

//Memory allocated through stackalloc is automatically free‘d

//by the CLR.

return retVal;

}

private void mh_MouseClickEvent(object sender, MouseEventArgs e)

{

if (e.Button == MouseButtons.Left)

{

ClickPositionY = e.X;

sText = “(” + e.X.ToString() + “,” + e.Y.ToString() + “)”;

label1.Text = sText;

click_time = (DateTime.Now - localDate).TotalSeconds;

localDate = DateTime.Now;

if (e.X 》 (Screen.PrimaryScreen.Bounds.Width / 5 * 4))

{

if (click_time 《= 0.5)

{

click_count += 1;

label3.Text = “1”;

if (click_count 》 1)

{

click_count = 2;

label2.Text = “1”;

tri_click_flag = true;

}

else

{

label2.Text = “0”;

tri_click_flag = false;

}

textBox5.Text = click_count.ToString();

}

else

{

textBox5.Text = click_count.ToString();

}

if (click_count 《=1 && click_time 》 0.5)

click_count = 0;

}

else

{

label3.Text = “0”;

click_count = 0;

textBox5.Text = click_count.ToString();

label2.Text = “0”;

tri_click_flag = false;

}

}

}

private void mh_MouseMoveEvent(object sender, MouseEventArgs e)

{

int x = e.Location.X;

int y = e.Location.Y;

int LedData = 0;

LedData = (Screen.PrimaryScreen.Bounds.Height - y)*140/ Screen.PrimaryScreen.Bounds.Height;

if (LedData 《= 0)

LedData = 0;

if (e.X 》 (Screen.PrimaryScreen.Bounds.Width / 5 * 4))

{

if (tri_click_flag == true)

{

textBox6.Text = “1”;

SetBrightness(LedData);

label15.Text = LedData.ToString();

}

else

{

textBox6.Text = “0”;

}

}

textBox1.Text = x + “”;

textBox2.Text = y + “”;

textBox3.Text = Screen.PrimaryScreen.Bounds.Height.ToString();

textBox4.Text = Screen.PrimaryScreen.Bounds.Width.ToString();

}

private void Form1_FormClosed(object sender, FormClosedEventArgs e)

{

mh.UnHook();

}

private void Form1_FormClosed_1(object sender, FormClosedEventArgs e)

{

mh.UnHook();

}

private void textBox1_TextChanged(object sender, EventArgs e)

{

}

private void textBox2_TextChanged(object sender, EventArgs e)

{

}

private void label1_Click(object sender, EventArgs e)

{

}

private void textBox3_TextChanged(object sender, EventArgs e)

{

}

private void textBox4_TextChanged(object sender, EventArgs e)

{

}

private void label2_Click(object sender, EventArgs e)

{

}

private void label3_Click(object sender, EventArgs e)

{

}

private void textBox5_TextChanged(object sender, EventArgs e)

{

}

private void textBox6_TextChanged(object sender, EventArgs e)

{

}

private void mh_MouseDownEvent(object sender, MouseEventArgs e)

{

if (e.Button == MouseButtons.Left)

{

richTextBox1.AppendText(“按下了左键 ”);

}

}

private void mh_MouseUpEvent(object sender, MouseEventArgs e)

{

if (e.Button == MouseButtons.Left)

{

richTextBox1.AppendText(“松开了左键 ”);

}

}

private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)

{

}

private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)

{

}

private void exitToolStripMenuItem_Click(object sender, EventArgs e)

{

Application.ExitThread();

Environment.Exit(0);

}

private void label13_Click(object sender, EventArgs e)

{

}

private void label14_Click(object sender, EventArgs e)

{

}

private void label15_Click(object sender, EventArgs e)

{

}

private void richTextBox1_TextChanged(object sender, EventArgs e)

{

}

}

public class Win32Api

{

[StructLayout(LayoutKind.Sequential)]

public class POINT

{

public int x;

public int y;

}

[StructLayout(LayoutKind.Sequential)]

public class MouseHookStruct

{

public POINT pt;

public int hwnd;

public int wHitTestCode;

public int dwExtraInfo;

}

public delegate int HookProc(int nCode, IntPtr wParam, IntPtr lParam);

//安装钩子

[DllImport(“user32.dll”, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]

public static extern int SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, int threadId);

//卸载钩子

[DllImport(“user32.dll”, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]

public static extern bool UnhookWindowsHookEx(int idHook);

//调用下一个钩子

[DllImport(“user32.dll”, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]

public static extern int CallNextHookEx(int idHook, int nCode, IntPtr wParam, IntPtr lParam);

}

public class MouseHook

{

private Point point;

private Point Point

{

get { return point; }

set

{

if (point != value)

{

point = value;

if (MouseMoveEvent != null)

{

var e = new MouseEventArgs(MouseButtons.None, 0, point.X, point.Y, 0);

MouseMoveEvent(this, e);

}

}

}

}

private int hHook;

private const int WM_LBUTTONDOWN = 0x201;

private const int WM_LBUTTONUP = 0x202;

public const int WH_MOUSE_LL = 14;

public Win32Api.HookProc hProc;

public MouseHook()

{

this.Point = new Point();

}

public int SetHook()

{

hProc = new Win32Api.HookProc(MouseHookProc);

hHook = Win32Api.SetWindowsHookEx(WH_MOUSE_LL, hProc, IntPtr.Zero, 0);

return hHook;

}

public void UnHook()

{

Win32Api.UnhookWindowsHookEx(hHook);

}

private int MouseHookProc(int nCode, IntPtr wParam, IntPtr lParam)

{

Win32Api.MouseHookStruct MyMouseHookStruct = (Win32Api.MouseHookStruct)Marshal.PtrToStructure(lParam, typeof(Win32Api.MouseHookStruct));

if (nCode 《 0)

{

return Win32Api.CallNextHookEx(hHook, nCode, wParam, lParam);

}

else

{

if (MouseClickEvent != null)

{

MouseButtons button = MouseButtons.None;

int clickCount = 0;

switch ((Int32)wParam)

{

case WM_LBUTTONDOWN:

button = MouseButtons.Left;

clickCount = 1;

break;

case WM_LBUTTONUP:

button = MouseButtons.Left;

clickCount = 1;

break;

}

var e = new MouseEventArgs(button, clickCount, point.X, point.Y, 0);

MouseClickEvent(this, e);

}

this.Point = new Point(MyMouseHookStruct.pt.x, MyMouseHookStruct.pt.y);

return Win32Api.CallNextHookEx(hHook, nCode, wParam, lParam);

}

}

public delegate void MouseMoveHandler(object sender, MouseEventArgs e);

public event MouseMoveHandler MouseMoveEvent;

public delegate void MouseClickHandler(object sender, MouseEventArgs e);

public event MouseClickHandler MouseClickEvent;

public delegate void MouseDownHandler(object sender, MouseEventArgs e);

public event MouseDownHandler MouseDownEvent;

public delegate void MouseUpHandler(object sender, MouseEventArgs e);

public event MouseUpHandler MouseUpEvent;

}

}

方法2:

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.Runtime.InteropServices;

using System.Globalization;

//using LattePanda.Firmata;

namespace Demo_mousehook_csdn

{

public partial class Form1 : Form

{

//static Arduino arduino = new Arduino();

static DateTime localDate = DateTime.Now;

double click_time;

int click_count = 0;

bool tri_click_flag = false;

bool mouse_down_flag = false;

static string sText=“”;

static int ClickPositionY = 0;

static int LedData = 0;//需要发送的LED亮度值

static int LedIncreaseData = 0; //Data增量

static int LedLastData = 0;//Led的最后一次亮度

static int LedStoreData = 0;//Led需要储藏的数值,备用

[DllImport(“gdi32.dll”)]

private unsafe static extern bool SetDeviceGammaRamp(Int32 hdc, void* ramp);

private static bool initialized = false;

private static Int32 hdc;

private static void InitializeClass()

{

if (initialized)

return;

//Get the hardware device context of the screen, we can do

//this by getting the graphics object of null (IntPtr.Zero)

//then getting the HDC and converting that to an Int32.

hdc = Graphics.FromHwnd(IntPtr.Zero).GetHdc().ToInt32();

initialized = false;

}

public static unsafe bool SetBrightness(int brightness)

{

InitializeClass();

if (brightness 》 255)

brightness = 255;

if (brightness 《 0)

brightness = 0;

short* gArray = stackalloc short[3 * 256];

short* idx = gArray;

for (int j = 0; j 《 3; j++)

{

for (int i = 0; i 《 256; i++)

{

int arrayVal = i * (brightness + 128);

if (arrayVal 》 65535)

arrayVal = 65535;

*idx = (short)arrayVal;

idx++;

}

}

//For some reason, this always returns false?

bool retVal = SetDeviceGammaRamp(hdc, gArray);

//Memory allocated through stackalloc is automatically free’d

//by the CLR.

return retVal;

}

public Form1()

{

InitializeComponent();

// arduino.pinMode(13, Arduino.OUTPUT);//

}

MouseHook mh;

// protected override void SetVisibleCore(bool value)

// {

// base.SetVisibleCore(false);

// }

private void Form1_Load(object sender, EventArgs e)

{

mh = new MouseHook();

mh.SetHook();

mh.MouseMoveEvent += mh_MouseMoveEvent;

mh.MouseClickEvent += mh_MouseClickEvent;

mh.MouseUpEvent += mh_MouseUpEvent;

mh.MouseDownEvent += mh_MouseDownEvent;

}

private void mh_MouseUpEvent(object sender, MouseEventArgs e)

{

if (e.Button == MouseButtons.Left)

{

LedLastData = LedData;

mouse_down_flag = false;

richTextBox1.AppendText(“Released ”);

}

}

private void mh_MouseDownEvent(object sender, MouseEventArgs e)

{

if (e.Button == MouseButtons.Left)

{

mouse_down_flag = true;

click_time = (DateTime.Now - localDate).TotalSeconds;

localDate = DateTime.Now;

label13.Text = click_time.ToString();

richTextBox1.AppendText(“Pressed ”);

if (e.X 》 (Screen.PrimaryScreen.Bounds.Width / 5 * 4))

{

ClickPositionY= e.Location.Y;

if (click_time 《= 0.5)

{

click_count += 1;

label3.Text = “1”;

if (click_count 》 1)

{

click_count = 2;

label2.Text = “1”;

tri_click_flag = true;

}

else

{

label2.Text = “0”;

tri_click_flag = false;

}

textBox5.Text = click_count.ToString();

}

else

{

textBox5.Text = click_count.ToString();

}

if (click_count 《= 1 && click_time 》 0.5)

click_count = 0;

}

else

{

label3.Text = “0”;

click_count = 0;

textBox5.Text = click_count.ToString();

label2.Text = “0”;

tri_click_flag = false;

}

}

}

private void mh_MouseClickEvent(object sender, MouseEventArgs e)

{

if (e.Button == MouseButtons.Left)

{

sText = “(” + e.X.ToString() + “,” + e.Y.ToString() + “)”;

label1.Text = sText;

}

}

private void mh_MouseMoveEvent(object sender, MouseEventArgs e)

{

int x = e.Location.X;

int y = e.Location.Y;

if (e.X 》 (Screen.PrimaryScreen.Bounds.Width / 5 * 4))

{

if (tri_click_flag == true)

{

textBox6.Text = “1”;

if(mouse_down_flag==true)

{

LedIncreaseData = (ClickPositionY - y) * 140 / 1080;

LedData = LedStoreData + LedIncreaseData;

if(LedData《0)

{

LedData = 0;

}

if (LedData 》 140)

{

LedData = 140;

}

SetBrightness(LedData);

}

if(mouse_down_flag==false)

{

LedStoreData = LedLastData;

}

}

else

{

textBox6.Text = “0”;

}

}

label19.Text = LedStoreData.ToString();

label20.Text = LedData.ToString();

label15.Text = LedIncreaseData.ToString();

textBox1.Text = x + “”;

textBox2.Text = y + “”;

textBox3.Text = Screen.PrimaryScreen.Bounds.Height.ToString();

textBox4.Text = Screen.PrimaryScreen.Bounds.Width.ToString();

}

private void Form1_FormClosed(object sender, FormClosedEventArgs e)

{

mh.UnHook();

}

private void Form1_FormClosed_1(object sender, FormClosedEventArgs e)

{

mh.UnHook();

}

private void textBox1_TextChanged(object sender, EventArgs e)

{

}

private void textBox2_TextChanged(object sender, EventArgs e)

{

}

private void label1_Click(object sender, EventArgs e)

{

}

private void textBox3_TextChanged(object sender, EventArgs e)

{

}

private void textBox4_TextChanged(object sender, EventArgs e)

{

}

private void label2_Click(object sender, EventArgs e)

{

}

private void label3_Click(object sender, EventArgs e)

{

}

private void textBox5_TextChanged(object sender, EventArgs e)

{

}

private void textBox6_TextChanged(object sender, EventArgs e)

{

}

private void Form1_MouseDown(object sender, MouseEventArgs e)

{

}

private void Form1_MouseUp(object sender, MouseEventArgs e)

{

}

private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)

{

}

private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)

{

}

private void exitToolStripMenuItem_Click(object sender, EventArgs e)

{

Application.ExitThread();

Environment.Exit(0);

}

private void label13_Click(object sender, EventArgs e)

{

}

private void label14_Click(object sender, EventArgs e)

{

}

private void label15_Click(object sender, EventArgs e)

{

}

private void richTextBox1_TextChanged(object sender, EventArgs e)

{

}

private void label19_Click(object sender, EventArgs e)

{

}

private void label20_Click(object sender, EventArgs e)

{

}

}

public class Win32Api

{

[StructLayout(LayoutKind.Sequential)]

public class POINT

{

public int x;

public int y;

}

[StructLayout(LayoutKind.Sequential)]

public class MouseHookStruct

{

public POINT pt;

public int hwnd;

public int wHitTestCode;

public int dwExtraInfo;

}

public delegate int HookProc(int nCode, IntPtr wParam, IntPtr lParam);

//安装钩子

[DllImport(“user32.dll”, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]

public static extern int SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, int threadId);

//卸载钩子

[DllImport(“user32.dll”, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]

public static extern bool UnhookWindowsHookEx(int idHook);

//调用下一个钩子

[DllImport(“user32.dll”, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]

public static extern int CallNextHookEx(int idHook, int nCode, IntPtr wParam, IntPtr lParam);

}

public class MouseHook

{

private Point point;

private Point Point

{

get { return point; }

set

{

if (point != value)

{

point = value;

if (MouseMoveEvent != null)

{

var e = new MouseEventArgs(MouseButtons.None, 0, point.X, point.Y, 0);

MouseMoveEvent(this, e);

}

}

}

}

private int hHook;

private const int WM_LBUTTONDOWN = 0x201;

private const int WM_LBUTTONUP = 0x202;

public const int WH_MOUSE_LL = 14;

public Win32Api.HookProc hProc;

public MouseHook()

{

this.Point = new Point();

}

public int SetHook()

{

hProc = new Win32Api.HookProc(MouseHookProc);

hHook = Win32Api.SetWindowsHookEx(WH_MOUSE_LL, hProc, IntPtr.Zero, 0);

return hHook;

}

public void UnHook()

{

Win32Api.UnhookWindowsHookEx(hHook);

}

private int MouseHookProc(int nCode, IntPtr wParam, IntPtr lParam)

{

Win32Api.MouseHookStruct MyMouseHookStruct = (Win32Api.MouseHookStruct)Marshal.PtrToStructure(lParam, typeof(Win32Api.MouseHookStruct));

if (nCode 《 0)

{

return Win32Api.CallNextHookEx(hHook, nCode, wParam, lParam);

}

else

{

if (MouseClickEvent != null)

{

MouseButtons button = MouseButtons.None;

int clickCount = 0;

switch ((Int32)wParam)

{

case WM_LBUTTONDOWN:

button = MouseButtons.Left;

clickCount = 1;

MouseDownEvent(this, new MouseEventArgs(button, clickCount, point.X, point.Y, 0));

break;

case WM_LBUTTONUP:

button = MouseButtons.Left;

clickCount = 1;

MouseUpEvent(this, new MouseEventArgs(button, clickCount, point.X, point.Y, 0));

break;

}

var e = new MouseEventArgs(button, clickCount, point.X, point.Y, 0);

MouseClickEvent(this, e);

}

this.Point = new Point(MyMouseHookStruct.pt.x, MyMouseHookStruct.pt.y);

return Win32Api.CallNextHookEx(hHook, nCode, wParam, lParam);

}

}

public delegate void MouseMoveHandler(object sender, MouseEventArgs e);

public event MouseMoveHandler MouseMoveEvent;

public delegate void MouseClickHandler(object sender, MouseEventArgs e);

public event MouseClickHandler MouseClickEvent;

public delegate void MouseUpHandler(object sender, MouseEventArgs e);

public event MouseUpHandler MouseUpEvent;

public delegate void MouseDownHandler(object sender, MouseEventArgs e);

public event MouseDownHandler MouseDownEvent;

}

}

玩得开心!

到目前为止还好吗?如有任何疑问,请告诉我!

步骤5:演示4:检测三次单击并控制LED灯

在此演示中,您将获得鼠标的位置并将实时值发送到Arduino。然后您的Arduino可以根据该值控制LED。

播放DEMO 4的方法:

在屏幕右侧的1/5上单击三下,您将进入GPIO控制模式,移动您的GPIO手指向上或向下,LED(D13)会变亮或变暗。

此演示涉及PC与Arduino之间的通信(Arduino和C#通信)。如果您想了解这部分知识,请参阅此处的教程。

您可以在附件中查看代码,也可以在此处下载演示。

Demo 4代码:

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.Runtime.InteropServices;

using System.Globalization;

using LattePanda.Firmata;

namespace Demo_mousehook_csdn

{

public partial class Form1 : Form

{

static Arduino arduino = new Arduino();

static DateTime localDate = DateTime.Now;

double click_time;

int click_count = 0;

bool tri_click_flag = false;

bool mouse_down_flag = false;

static string sText=“”;

static int ClickPositionY = 0;

static int LedData = 0;//需要发送的LED亮度值

static int LedIncreaseData = 0; //Data增量

static int LedLastData = 0;//Led的最后一次亮度

static int LedStoreData = 0;//Led需要储藏的数值,备用

public Form1()

{

InitializeComponent();

arduino.pinMode(13, Arduino.PWM);//

}

MouseHook mh;

private void Form1_Load(object sender, EventArgs e)

{

mh = new MouseHook();

mh.SetHook();

mh.MouseMoveEvent += mh_MouseMoveEvent;

mh.MouseClickEvent += mh_MouseClickEvent;

mh.MouseUpEvent += mh_MouseUpEvent;

mh.MouseDownEvent += mh_MouseDownEvent;

}

private void mh_MouseUpEvent(object sender, MouseEventArgs e)

{

if (e.Button == MouseButtons.Left)

{

LedLastData = LedData;

mouse_down_flag = false;

richTextBox1.AppendText(“Released ”);

}

}

private void mh_MouseDownEvent(object sender, MouseEventArgs e)

{

if (e.Button == MouseButtons.Left)

{

mouse_down_flag = true;

click_time = (DateTime.Now - localDate).TotalSeconds;

localDate = DateTime.Now;

label13.Text = click_time.ToString();

richTextBox1.AppendText(“Pressed ”);

if (e.X 》 (Screen.PrimaryScreen.Bounds.Width / 5 * 4))

{

ClickPositionY= e.Location.Y;

if (click_time 《= 0.5)

{

click_count += 1;

label3.Text = “1”;

if (click_count 》 1)

{

click_count = 2;

label2.Text = “1”;

tri_click_flag = true;

}

else

{

label2.Text = “0”;

tri_click_flag = false;

}

textBox5.Text = click_count.ToString();

}

else

{

textBox5.Text = click_count.ToString();

}

if (click_count 《= 1 && click_time 》 0.5)

click_count = 0;

}

else

{

label3.Text = “0”;

click_count = 0;

textBox5.Text = click_count.ToString();

label2.Text = “0”;

tri_click_flag = false;

}

}

}

private void mh_MouseClickEvent(object sender, MouseEventArgs e)

{

if (e.Button == MouseButtons.Left)

{

sText = “(” + e.X.ToString() + “,” + e.Y.ToString() + “)”;

label1.Text = sText;

}

}

private void mh_MouseMoveEvent(object sender, MouseEventArgs e)

{

int x = e.Location.X;

int y = e.Location.Y;

if (e.X 》 (Screen.PrimaryScreen.Bounds.Width / 5 * 4))

{

if (tri_click_flag == true)

{

textBox6.Text = “1”;

if(mouse_down_flag==true)

{

LedIncreaseData = (ClickPositionY - y) * 140 / 1080;

LedData = LedStoreData + LedIncreaseData;

if(LedData《0)

{

LedData = 0;

}

if (LedData 》 140)

{

LedData = 140;

}

arduino.analogWrite(13,LedData);

}

if(mouse_down_flag==false)

{

LedStoreData = LedLastData;

}

}

else

{

textBox6.Text = “0”;

}

}

label19.Text = LedStoreData.ToString();

label20.Text = LedData.ToString();

label15.Text = LedIncreaseData.ToString();

textBox1.Text = x + “”;

textBox2.Text = y + “”;

textBox3.Text = Screen.PrimaryScreen.Bounds.Height.ToString();

textBox4.Text = Screen.PrimaryScreen.Bounds.Width.ToString();

}

private void Form1_FormClosed(object sender, FormClosedEventArgs e)

{

mh.UnHook();

}

private void Form1_FormClosed_1(object sender, FormClosedEventArgs e)

{

mh.UnHook();

}

private void textBox1_TextChanged(object sender, EventArgs e)

{

}

private void textBox2_TextChanged(object sender, EventArgs e)

{

}

private void label1_Click(object sender, EventArgs e)

{

}

private void textBox3_TextChanged(object sender, EventArgs e)

{

}

private void textBox4_TextChanged(object sender, EventArgs e)

{

}

private void label2_Click(object sender, EventArgs e)

{

}

private void label3_Click(object sender, EventArgs e)

{

}

private void textBox5_TextChanged(object sender, EventArgs e)

{

}

private void textBox6_TextChanged(object sender, EventArgs e)

{

}

private void Form1_MouseDown(object sender, MouseEventArgs e)

{

}

private void Form1_MouseUp(object sender, MouseEventArgs e)

{

}

private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)

{

}

private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)

{

}

private void exitToolStripMenuItem_Click(object sender, EventArgs e)

{

Application.ExitThread();

Environment.Exit(0);

}

private void label13_Click(object sender, EventArgs e)

{

}

private void label14_Click(object sender, EventArgs e)

{

}

private void label15_Click(object sender, EventArgs e)

{

}

private void richTextBox1_TextChanged(object sender, EventArgs e)

{

}

private void label19_Click(object sender, EventArgs e)

{

}

private void label20_Click(object sender, EventArgs e)

{

}

}

public class Win32Api

{

[StructLayout(LayoutKind.Sequential)]

public class POINT

{

public int x;

public int y;

}

[StructLayout(LayoutKind.Sequential)]

public class MouseHookStruct

{

public POINT pt;

public int hwnd;

public int wHitTestCode;

public int dwExtraInfo;

}

public delegate int HookProc(int nCode, IntPtr wParam, IntPtr lParam);

//安装钩子

[DllImport(“user32.dll”, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]

public static extern int SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, int threadId);

//卸载钩子

[DllImport(“user32.dll”, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]

public static extern bool UnhookWindowsHookEx(int idHook);

//调用下一个钩子

[DllImport(“user32.dll”, CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]

public static extern int CallNextHookEx(int idHook, int nCode, IntPtr wParam, IntPtr lParam);

}

public class MouseHook

{

private Point point;

private Point Point

{

get { return point; }

set

{

if (point != value)

{

point = value;

if (MouseMoveEvent != null)

{

var e = new MouseEventArgs(MouseButtons.None, 0, point.X, point.Y, 0);

MouseMoveEvent(this, e);

}

}

}

}

private int hHook;

private const int WM_LBUTTONDOWN = 0x201;

private const int WM_LBUTTONUP = 0x202;

public const int WH_MOUSE_LL = 14;

public Win32Api.HookProc hProc;

public MouseHook()

{

this.Point = new Point();

}

public int SetHook()

{

hProc = new Win32Api.HookProc(MouseHookProc);

hHook = Win32Api.SetWindowsHookEx(WH_MOUSE_LL, hProc, IntPtr.Zero, 0);

return hHook;

}

public void UnHook()

{

Win32Api.UnhookWindowsHookEx(hHook);

}

private int MouseHookProc(int nCode, IntPtr wParam, IntPtr lParam)

{

Win32Api.MouseHookStruct MyMouseHookStruct = (Win32Api.MouseHookStruct)Marshal.PtrToStructure(lParam, typeof(Win32Api.MouseHookStruct));

if (nCode 《 0)

{

return Win32Api.CallNextHookEx(hHook, nCode, wParam, lParam);

}

else

{

if (MouseClickEvent != null)

{

MouseButtons button = MouseButtons.None;

int clickCount = 0;

switch ((Int32)wParam)

{

case WM_LBUTTONDOWN:

button = MouseButtons.Left;

clickCount = 1;

MouseDownEvent(this, new MouseEventArgs(button, clickCount, point.X, point.Y, 0));

break;

case WM_LBUTTONUP:

button = MouseButtons.Left;

clickCount = 1;

MouseUpEvent(this, new MouseEventArgs(button, clickCount, point.X, point.Y, 0));

break;

}

var e = new MouseEventArgs(button, clickCount, point.X, point.Y, 0);

MouseClickEvent(this, e);

}

this.Point = new Point(MyMouseHookStruct.pt.x, MyMouseHookStruct.pt.y);

return Win32Api.CallNextHookEx(hHook, nCode, wParam, lParam);

}

}

public delegate void MouseMoveHandler(object sender, MouseEventArgs e);

public event MouseMoveHandler MouseMoveEvent;

public delegate void MouseClickHandler(object sender, MouseEventArgs e);

public event MouseClickHandler MouseClickEvent;

public delegate void MouseUpHandler(object sender, MouseEventArgs e);

public event MouseUpHandler MouseUpEvent;

public delegate void MouseDownHandler(object sender, MouseEventArgs e);

public event MouseDownHandler MouseDownEvent;

}

}

如果您有任何疑问,请告诉我!

步骤6:摘要:

您得到的货款!在Respberry Pi上运行Win10时,我不能忍受滞后。当您需要在SBC及其基于x64的处理器上进行大型项目时,LattePanda是一个不错的选择。 LattePanda的CPU可以完美地处理大型项目。它也可以完美地运行Ubuntu。对我来说,LattePanda是一个训练我的编码能力的好平台。由于它运行Win10系统,因此我可以使用Visual Studio在C ++,C#,Python等中执行许多项目。更重要的是,它还配备了Arduino Leonardo。我可以在PC上轻松控制物理世界。

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
  • C#
    +关注

    关注

    0

    文章

    6

    浏览量

    23847
  • IOT
    IOT
    +关注

    关注

    186

    文章

    4175

    浏览量

    196184
收藏 人收藏

    评论

    相关推荐

    以太网IO控制卡:C#实时读写时间测试

    C#语言进行ECI IO卡的项目开发和快速读取多个IO状态与上位机交互速度的测试结果
    的头像 发表于 11-21 13:50 60次阅读
    以太网IO<b class='flag-5'>控制</b>卡:<b class='flag-5'>C#</b>实时读写时间测试

    Cortex-A55国产处理器_教学实验箱_操作案例分享:5-21 手势识别实验

    ,用户可通过I²C接口总线采集信号迅速识别出UP、Down、Right、Left等9种常用手势。另外PAJ7620U2还提供内置的接近检测功能,用于
    发表于 10-15 16:18

    使用OpenVINO C# API部署YOLO-World实现实时开放词汇对象检测

    的快速准确识别,通过AR技术将虚拟元素与真实场景相结合,为用户带来沉浸式的交互体验。本文中,我们将结合OpenVINO C# API使用最新发布的OpenVINO 2024.0部署 YOLO-World实现实时开放词汇对象
    的头像 发表于 08-30 16:27 543次阅读
    使用OpenVINO <b class='flag-5'>C#</b> API部署YOLO-World实现实时开放词汇对象<b class='flag-5'>检测</b>

    论述RISC-CIOT领域的发展机会

    的选择。 低功耗与低成本: RISC-V的低功耗设计使其IoT设备具有极高的竞争力。IoT设备往往需要长时间运行且不易频繁更换电池,因此低功耗成为了一个关键需求。RISC-V通过精
    发表于 06-27 08:43

    用OpenVINO C# APIintel平台部署YOLOv10目标检测模型

    的模型设计策略,从效率和精度两个角度对YOLOs的各个组成部分进行了全面优化,大大降低了计算开销,增强了性能。本文中,我们将结合OpenVINO C# API使用最新发布的OpenVINO 2024.1部署YOLOv10目标检测
    的头像 发表于 06-21 09:23 937次阅读
    用OpenVINO <b class='flag-5'>C#</b> API<b class='flag-5'>在</b>intel平台部署YOLOv10目标<b class='flag-5'>检测</b>模型

    基于毫米波雷达的手势识别算法

    ,家庭客厅、多人和实时情况)是稳健的,讨论了当前的局限性和几种潜在的解决方案。 所提出的模型旨在尝试远程场景基于毫米波的手势识别,该模型可以应用于我们日常生活的许多方面。具体来说
    发表于 06-05 19:09

    基于毫米波雷达的手势识别神经网络

    预处理后的信号输入卷积神经网络时域卷积网络(CNNTCN)模型,提取时空特征,通过分类评估识别性能。实验结果表明,该方法特定领域的识别实现了98.2%的准确率,并在不同的神经网络中保持了一致的高
    发表于 05-23 12:12

    简单易用的以太网数据采集卡应用开发之C#

    C#语言以太网数据采集卡的开发。
    的头像 发表于 05-17 14:25 675次阅读
    简单易用的以太网数据采集卡应用开发之<b class='flag-5'>C#</b>

    我用全志V851s做了一个魔法棒,使用Keras训练手势识别模型控制一切电子设备

    挥棒手势数据 Keras 挥棒手势识别模型训练 V851s 赛博魔杖 蓝牙控制的简易舵机开关灯装置_HLK-B40 原神 蓝牙安卓启动器 1、工程附件
    发表于 02-04 10:44

    nb-iot单灯控制的nb-iot是什么?

    nb-iot单灯控制的nb-iot是什么? NB-IoT是一种低功耗宽带物联网技术,主要应用于物联网设备的通信连接。它基于现有的蜂窝网络
    的头像 发表于 02-03 11:34 1510次阅读

    单轴PSO视觉飞拍与精准输出:EtherCAT超高速实时运动控制卡XPCIE1032H上位机C#开发(七)

    正运动技术EtherCAT控制卡在VS平台采用C#语言实现的各种PSO功能。
    的头像 发表于 01-03 09:50 1001次阅读
    单轴PSO视觉飞拍与精准输出:EtherCAT超高速实时运动<b class='flag-5'>控制</b>卡XPCIE1032H上位机<b class='flag-5'>C#</b>开发(七)

    C#网络串口调试助手源码

    非常牛B网络串口调试助手C#源码,支持添加多条协议
    发表于 12-27 09:45 4次下载

    怎样快速检测电机的好坏

    电机是电工日常工作接触最多的电器元件,那么,日常检修和安装过程怎样快速检测一台电机是否好坏呢?第一步:用摇表摇测电机对地绝缘。
    的头像 发表于 12-01 10:08 1562次阅读

    基于ADUX1020的手势识别实现方案

    嘈声环境持续稳定工作。该芯片有多种模式配置,以实现非接触式手势识别和控制,还能实现距离检测手势识别基础 ADUX1020能够灵敏感测入
    发表于 11-28 16:26 0次下载
    基于ADUX1020的<b class='flag-5'>手势</b>识别实现方案

    用科技改变生活:帕克西手势识别技术解析

    帕克西手势识别是通过普通PC/手机摄像头,快速检测返回图片或视频手势/动作,深度解析用户的行为信息,提供基于普通摄像头的全新
    的头像 发表于 11-27 15:05 493次阅读