It's just an experiment :
Read more- I was thinking can M5stack work as a mouse for my PC
- then I did some programming and a little bit of research.
- And Yeah It's possible.
- As I have the core kit of M5Stack Core there is no imu in it. so that's why I added an MPU6050 in it. to get all data I need.
- I use some female headers to connect it
and connected it to M5Stack.
VCC ---- 3.3v
GND ---- GND
SCL ---- SCL
SDA ---- SDA
How it works:- firstly we need to understand these terms.
- so we move in the X and Y plane on the PC screen.
- so I am using pitch and roll.
- so if roll >= 40 then it will write H in the Serial.
- then by using python serial lib.
- we are able to read serial values.
- then if it finds H in then it will move the mouse in +5 in the x-axis.
- so if roll >= -40 then it will write B in the Serial.
- then by using python serial lib.
- we are able to read serial values.
- then if it finds B in then it will move the mouse in -5 in the x-axis.
- so if pitch >= 40 then it will write L in the Serial.
- then by using python serial lib.
- we are able to read serial values.
- then if it finds L in then it will move the mouse in +5 in the y-axis.
- so if pitch >= -40 then it will write P in the Serial.
- then by using python serial lib.
- we are able to read serial values.
- then if it finds P in then it will move the mouse in -5 in the y-axis.
- so if the B button (middle button) is pressed then it will write C in the Serial.
- then by using python serial lib.
- we are able to read serial values.
- then if it finds C in then it will simulate the left click of the mouse.
- so I'm using the sketch that comes with the M5Stack library.
- I'm modifying the sketch as per my need.
- firstly upload the Arduino code that I gave on M5Stack.
- then paste code on the python interpreter then run the program.
- WARNING: don't close Arduino ide while using M5Stack mouse.
- left pc screen vid is 2sec early.
Comments