Implementation that acts as a Horizontal Mouse Wheel with contactless control. For this implementation, we need just two electronics component and simple code written with Python.
First things first, lets built up electronics side. Arduino is our microcontroller. Also, I used HC-SR04 ultrasonic sensor for detect distance. When the ended up connecttions about Arduino and HC-SR04 required install this code which about distance detection to Arduino.
Lets move on to the fun part now. Two packages need to be installed before writing code with Python.
pip install pyserial
pip install PyAutoGUI
We have to complete serial communications between Python and Arduino. pyserial package provides that. Distance results created by sensor send to Python with serial comm. Other package pyAutoGUI, allows us to switch between Python and computer GUI platform. Thus, desired commands can be assigned for mouse or keyboard.
Lastly, run this Python code. Everything is ready!