精品国产人成在线_亚洲高清无码在线观看_国产在线视频国产永久2021_国产AV综合第一页一个的一区免费影院黑人_最近中文字幕MV高清在线视频

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評(píng)論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會(huì)員中心
創(chuàng)作中心

完善資料讓更多小伙伴認(rèn)識(shí)你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示

怎樣在C#中檢測(cè)手勢(shì)并控制IoT

454398 ? 來(lái)源:wv ? 2019-10-13 17:24 ? 次閱讀

步驟1:您需要的內(nèi)容:

怎樣在C#中檢測(cè)手勢(shì)并控制IoT

硬件

LattePanda(您可以

屏幕和觸摸面板

軟件

Arduino IDE

Visual Studio

步驟2:演示1:檢測(cè)鼠標(biāo)位置并單擊事件

讓我們執(zhí)行項(xiàng)目步驟一步一步首先,請(qǐng)嘗試檢測(cè)是否按下了鼠標(biāo)。因此,我們可以根據(jù)間隔來(lái)檢測(cè)雙擊和三次單擊。

這是一個(gè)簡(jiǎn)單的Windows Form應(yīng)用程序。文本框?qū)@示鼠標(biāo)的X軸和Y軸。 您可以在PC上播放此演示。

操作方法播放演示1:

運(yùn)行.exe并移動(dòng)鼠標(biāo),軟件將自動(dòng)檢測(cè)鼠標(biāo)的位置。如果按下鼠標(biāo)左鍵,文本框?qū)@示該事件。

您可以在下面查看代碼或在此處下載演示。如果要自己制作此演示,則需要在此處下載Visual Studio。 Open.sln文件,然后可以將其設(shè)置為自己的文件。

演示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;

}

}

如果有任何疑問(wèn),請(qǐng)讓我知道!

步驟3:演示2:檢測(cè)雙擊并控制LED

請(qǐng)參見上圖。為了防止錯(cuò)誤觸發(fā),我在屏幕區(qū)域的右1/5處設(shè)置了檢測(cè)鼠標(biāo)雙擊的功能。

在此演示中,您將知道如何檢測(cè)雙擊(只需計(jì)算兩次單擊的間隔)并通過(guò)Arduino Leonardo控制LED。

此演示涉及C#和Arduino串行通信(PC與Arduino之間的通信)。如果您想了解這部分知識(shí),請(qǐng)參見此處的教程

如何播放演示2:

雙擊右側(cè)1/5側(cè)面屏幕上的,然后您將進(jìn)入GPIO控制模式,LED將會(huì)點(diǎn)亮。單擊屏幕左側(cè)的4/5側(cè),LED將關(guān)閉。

您可以在附件中查看代碼或在此處下載演示。如果最小化窗口,則該功能仍然有效。很酷,不是嗎?

演示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);

//調(diào)用下一個(gè)鉤子

[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;

}

}

這是一種進(jìn)行交互項(xiàng)目的新方法。它也可以用于家庭自動(dòng)化控制系統(tǒng)。使用PC來(lái)控制空調(diào),燈光,電視等。

步驟4:演示3:檢測(cè)三次單擊并控制屏幕背景光

在此演示中,您將獲得鼠標(biāo)的位置并將實(shí)時(shí)值發(fā)送到PC。然后,您的PC可以根據(jù)該值更改背景光。 您還可以在PC上播放此演示。

此演示涉及使用C#來(lái)控制屏幕的背景光。如果您想了解這一部分知識(shí),可以在這里查看教程。

如何播放演示3:

在右側(cè)1/3上單擊三次。屏幕的5側(cè),然后您將進(jìn)入GPIO控制模式,向上或向下移動(dòng)手指,屏幕的背景光會(huì)變暗或變暗。

此功能與您的iPhone有點(diǎn)相似。您可以在附件中查看代碼或在此處下載演示。

方法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);

//調(diào)用下一個(gè)鉤子

[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;//需要發(fā)送的LED亮度值

static int LedIncreaseData = 0; //Data增量

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

static int LedStoreData = 0;//Led需要儲(chǔ)藏的數(shù)值,備用

[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);

//調(diào)用下一個(gè)鉤子

[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;

}

}

玩得開心!

到目前為止還好嗎?如有任何疑問(wèn),請(qǐng)告訴我!

步驟5:演示4:檢測(cè)三次單擊并控制LED燈

在此演示中,您將獲得鼠標(biāo)的位置并將實(shí)時(shí)值發(fā)送到Arduino。然后您的Arduino可以根據(jù)該值控制LED。

播放DEMO 4的方法:

在屏幕右側(cè)的1/5上單擊三下,您將進(jìn)入GPIO控制模式,移動(dòng)您的GPIO手指向上或向下,LED(D13)會(huì)變亮或變暗。

此演示涉及PC與Arduino之間的通信(Arduino和C#通信)。如果您想了解這部分知識(shí),請(qǐng)參閱此處的教程。

您可以在附件中查看代碼,也可以在此處下載演示。

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;//需要發(fā)送的LED亮度值

static int LedIncreaseData = 0; //Data增量

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

static int LedStoreData = 0;//Led需要儲(chǔ)藏的數(shù)值,備用

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);

//調(diào)用下一個(gè)鉤子

[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;

}

}

如果您有任何疑問(wèn),請(qǐng)告訴我!

步驟6:摘要:

您得到的貨款!在Respberry Pi上運(yùn)行Win10時(shí),我不能忍受滯后。當(dāng)您需要在SBC及其基于x64的處理器上進(jìn)行大型項(xiàng)目時(shí),LattePanda是一個(gè)不錯(cuò)的選擇。 LattePanda的CPU可以完美地處理大型項(xiàng)目。它也可以完美地運(yùn)行Ubuntu。對(duì)我來(lái)說(shuō),LattePanda是一個(gè)訓(xùn)練我的編碼能力的好平臺(tái)。由于它運(yùn)行Win10系統(tǒng),因此我可以使用Visual Studio在C ++,C#,Python等中執(zhí)行許多項(xiàng)目。更重要的是,它還配備了Arduino Leonardo。我可以在PC上輕松控制物理世界。

聲明:本文內(nèi)容及配圖由入駐作者撰寫或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點(diǎn)僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場(chǎng)。文章及其配圖僅供工程師學(xué)習(xí)之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問(wèn)題,請(qǐng)聯(lián)系本站處理。 舉報(bào)投訴
  • C#
    +關(guān)注

    關(guān)注

    0

    文章

    6

    瀏覽量

    23847
  • IOT
    IOT
    +關(guān)注

    關(guān)注

    186

    文章

    4181

    瀏覽量

    196278
收藏 人收藏

    評(píng)論

    相關(guān)推薦

    以太網(wǎng)IO控制卡:C#實(shí)時(shí)讀寫時(shí)間測(cè)試

    C#語(yǔ)言進(jìn)行ECI IO卡的項(xiàng)目開發(fā)和快速讀取多個(gè)IO狀態(tài)與上位機(jī)交互速度的測(cè)試結(jié)果
    的頭像 發(fā)表于 11-21 13:50 ?116次閱讀
    以太網(wǎng)IO<b class='flag-5'>控制</b>卡:<b class='flag-5'>C#</b>實(shí)時(shí)讀寫時(shí)間測(cè)試

    Cortex-A55國(guó)產(chǎn)處理器_教學(xué)實(shí)驗(yàn)箱_操作案例分享:5-21 手勢(shì)識(shí)別實(shí)驗(yàn)

    ,用戶可通過(guò)I2C接口總線采集信號(hào)迅速識(shí)別出UP、Down、Right、Left等9種常用手勢(shì)。另外PAJ7620U2還提供內(nèi)置的接近檢測(cè)功能,用于
    發(fā)表于 10-15 16:18

    使用OpenVINO C# API部署YOLO-World實(shí)現(xiàn)實(shí)時(shí)開放詞匯對(duì)象檢測(cè)

    的快速準(zhǔn)確識(shí)別,通過(guò)AR技術(shù)將虛擬元素與真實(shí)場(chǎng)景相結(jié)合,為用戶帶來(lái)沉浸式的交互體驗(yàn)。本文中,我們將結(jié)合OpenVINO C# API使用最新發(fā)布的OpenVINO 2024.0部署 YOLO-World實(shí)現(xiàn)實(shí)時(shí)開放詞匯對(duì)象
    的頭像 發(fā)表于 08-30 16:27 ?566次閱讀
    使用OpenVINO <b class='flag-5'>C#</b> API部署YOLO-World實(shí)現(xiàn)實(shí)時(shí)開放詞匯對(duì)象<b class='flag-5'>檢測(cè)</b>

    論述RISC-CIOT領(lǐng)域的發(fā)展機(jī)會(huì)

    的選擇。 低功耗與低成本: RISC-V的低功耗設(shè)計(jì)使其IoT設(shè)備具有極高的競(jìng)爭(zhēng)力。IoT設(shè)備往往需要長(zhǎng)時(shí)間運(yùn)行且不易頻繁更換電池,因此低功耗成為了一個(gè)關(guān)鍵需求。RISC-V通過(guò)精
    發(fā)表于 06-27 08:43

    用OpenVINO C# APIintel平臺(tái)部署YOLOv10目標(biāo)檢測(cè)模型

    的模型設(shè)計(jì)策略,從效率和精度兩個(gè)角度對(duì)YOLOs的各個(gè)組成部分進(jìn)行了全面優(yōu)化,大大降低了計(jì)算開銷,增強(qiáng)了性能。本文中,我們將結(jié)合OpenVINO C# API使用最新發(fā)布的OpenVINO 2024.1部署YOLOv10目標(biāo)檢測(cè)
    的頭像 發(fā)表于 06-21 09:23 ?952次閱讀
    用OpenVINO <b class='flag-5'>C#</b> API<b class='flag-5'>在</b>intel平臺(tái)部署YOLOv10目標(biāo)<b class='flag-5'>檢測(cè)</b>模型

    鴻蒙ArkTS聲明式開發(fā):跨平臺(tái)支持列表【綁定手勢(shì)方法】 手勢(shì)處理

    為組件綁定不同類型的手勢(shì)事件,設(shè)置事件的響應(yīng)方法。
    的頭像 發(fā)表于 06-15 09:17 ?729次閱讀
    鴻蒙ArkTS聲明式開發(fā):跨平臺(tái)支持列表【綁定<b class='flag-5'>手勢(shì)</b>方法】 <b class='flag-5'>手勢(shì)</b>處理

    基于毫米波雷達(dá)的手勢(shì)識(shí)別算法

    ,家庭客廳、多人和實(shí)時(shí)情況)是穩(wěn)健的,討論了當(dāng)前的局限性和幾種潛在的解決方案。 所提出的模型旨在嘗試遠(yuǎn)程場(chǎng)景基于毫米波的手勢(shì)識(shí)別,該模型可以應(yīng)用于我們?nèi)粘I畹脑S多方面。具體來(lái)說(shuō)
    發(fā)表于 06-05 19:09

    基于毫米波雷達(dá)的手勢(shì)識(shí)別神經(jīng)網(wǎng)絡(luò)

    預(yù)處理后的信號(hào)輸入卷積神經(jīng)網(wǎng)絡(luò)時(shí)域卷積網(wǎng)絡(luò)(CNNTCN)模型,提取時(shí)空特征,通過(guò)分類評(píng)估識(shí)別性能。實(shí)驗(yàn)結(jié)果表明,該方法特定領(lǐng)域的識(shí)別實(shí)現(xiàn)了98.2%的準(zhǔn)確率,并在不同的神經(jīng)網(wǎng)絡(luò)中保持了一致的高
    發(fā)表于 05-23 12:12

    簡(jiǎn)單易用的以太網(wǎng)數(shù)據(jù)采集卡應(yīng)用開發(fā)之C#

    C#語(yǔ)言以太網(wǎng)數(shù)據(jù)采集卡的開發(fā)。
    的頭像 發(fā)表于 05-17 14:25 ?695次閱讀
    簡(jiǎn)單易用的以太網(wǎng)數(shù)據(jù)采集卡應(yīng)用開發(fā)之<b class='flag-5'>C#</b>

    請(qǐng)問(wèn)MDK Middleware Network 的回調(diào)函數(shù)netTCP_cb_t的返回值我程序怎樣才能得到使用?

    請(qǐng)問(wèn)MDK Middleware Network 的回調(diào)函數(shù)netTCP_cb_t的返回值我程序怎樣才能得到使用?
    發(fā)表于 04-22 07:19

    我用全志V851s做了一個(gè)魔法棒,使用Keras訓(xùn)練手勢(shì)識(shí)別模型控制一切電子設(shè)備

    揮棒手勢(shì)數(shù)據(jù) Keras 揮棒手勢(shì)識(shí)別模型訓(xùn)練 V851s 賽博魔杖 藍(lán)牙控制的簡(jiǎn)易舵機(jī)開關(guān)燈裝置_HLK-B40 原神 藍(lán)牙安卓啟動(dòng)器 1、工程附件
    發(fā)表于 02-04 10:44

    nb-iot單燈控制的nb-iot是什么?

    nb-iot單燈控制的nb-iot是什么? NB-IoT是一種低功耗寬帶物聯(lián)網(wǎng)技術(shù),主要應(yīng)用于物聯(lián)網(wǎng)設(shè)備的通信連接。它基于現(xiàn)有的蜂窩網(wǎng)絡(luò)
    的頭像 發(fā)表于 02-03 11:34 ?1523次閱讀

    單軸PSO視覺飛拍與精準(zhǔn)輸出:EtherCAT超高速實(shí)時(shí)運(yùn)動(dòng)控制卡XPCIE1032H上位機(jī)C#開發(fā)(七)

    正運(yùn)動(dòng)技術(shù)EtherCAT控制卡在VS平臺(tái)采用C#語(yǔ)言實(shí)現(xiàn)的各種PSO功能。
    的頭像 發(fā)表于 01-03 09:50 ?1007次閱讀
    單軸PSO視覺飛拍與精準(zhǔn)輸出:EtherCAT超高速實(shí)時(shí)運(yùn)動(dòng)<b class='flag-5'>控制</b>卡XPCIE1032H上位機(jī)<b class='flag-5'>C#</b>開發(fā)(七)

    C#網(wǎng)絡(luò)串口調(diào)試助手源碼

    非常牛B網(wǎng)絡(luò)串口調(diào)試助手C#源碼,支持添加多條協(xié)議
    發(fā)表于 12-27 09:45 ?4次下載

    怎樣快速檢測(cè)電機(jī)的好壞

    電機(jī)是電工日常工作接觸最多的電器元件,那么,日常檢修和安裝過(guò)程怎樣快速檢測(cè)一臺(tái)電機(jī)是否好壞呢?第一步:用搖表?yè)u測(cè)電機(jī)對(duì)地絕緣。
    的頭像 發(fā)表于 12-01 10:08 ?1578次閱讀