Things used in this project

Hardware components:
Esp12e
Everything ESP ESP8266 ESP-12E
×1
13944 01
SparkFun 9DoF Sensor Stick
×1
Software apps and online services:
Ide web
Arduino IDE
D94d qxu
Autodesk Fusion 360
Hand tools and fabrication machines:
CNC Router

Schematics

Schematic
Schematic vazffjp8q8

Code

ESP8266 CodeC/C++
#include <Wire.h>
#include <SPI.h>
#include <SparkFunLSM9DS1.h>

LSM9DS1 imu;
#define LSM9DS1_M  0x1E 
#define LSM9DS1_AG  0x6B

#define PRINT_SPEED 500

void setup() {
  // put your setup code here, to run once:
  Wire.begin(4,5);
  Serial.begin(115200);
  imu.settings.device.commInterface = IMU_MODE_I2C;
  imu.settings.device.mAddress = LSM9DS1_M;
  imu.settings.device.agAddress = LSM9DS1_AG;
  if (!imu.begin())
  {
    Serial.println("Failed to communicate with LSM9DS1.");
    Serial.println("Double-check wiring.");
    Serial.println("Default settings in this sketch will " \
                  "work for an out of the box LSM9DS1 " \
                  "Breakout, but may need to be modified " \
                  "if the board jumpers are.");
    while (1)
      ;
  }
}

void loop() {
  // put your main code here, to run repeatedly:
if ( imu.accelAvailable() )
  {
    // To read from the accelerometer, first call the
    // readAccel() function. When it exits, it'll update the
    // ax, ay, and az variables with the most current data.
    imu.readAccel();
  }
  if(abs(imu.calcAccel(imu.ax))>1.9 || abs(imu.calcAccel(imu.ay))>1.9 || abs(imu.calcAccel(imu.az)) > 1.9){
      Serial.println("hit");
      delay(PRINT_SPEED);
    }
}
Python CodePython
import pyautogui
from time import sleep
from serial import Serial

pa = pyautogui

ser = Serial("COM10", baudrate=115200)

x, y = pa.size()

sleep(3)

pa.moveTo(x/2,y/2)

sleep(3)

try:
    while 1:
        if ser.in_waiting:
            data = ser.readline()
            print(data)
            if data:
                pa.click()

except KeyboardInterrupt:
    ser.close()

Credits

Download
Arduino “having11” Guy
25 projects • 165 followers
I love creating cloud solutions that can interact with hardware along with using Arduino boards and Raspberry Pis to create new projects.
Contact

Comments