Guest User

Untitled

a guest
Aug 1st, 2024
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. COM_Port := "\\.\COM3" ; Вкажіть правильний COM порт, до якого підключено Arduino
  2.  
  3. hSerial := DllCall("CreateFile", "Str", COM_Port, "UInt", 0xC0000000, "UInt", 3, "UInt", 0, "UInt", 3, "UInt", 0, "UInt", 0)
  4.  
  5. Loop {
  6.     VarSetCapacity(Buffer, 256)
  7.     DllCall("ReadFile", "Ptr", hSerial, "Str", Buffer, "UInt", 256, "UIntP", 0, "UInt", 0)
  8.  
  9.     if InStr(Buffer, "Motion detected") {
  10.         Send, #d ; Натискає комбінацію клавіш Win + D
  11.     }
  12.  
  13.     Sleep, 100
  14. }
  15.  
  16. OnExit:
  17. DllCall("CloseHandle", "Ptr", hSerial)
  18. ExitApp
  19.  
Advertisement
Add Comment
Please, Sign In to add comment