Bluetooth trackpad, esp32 issue

Hi, I attempted to make bluewtooth trackpad with an wemos lolin32 lite. I use a synaptics 920-000480-01RevA trackpad.I wired the clock pin to gpio0 and data pin to gpio16 in the esp32 modul. Because this modul doesn't have a 5v pin i gave it with an usb cabel directly to the trackpad.
I downloaded this ps2 library. I had some error in it with ''wprogram.h not found'', so changed it to arduino.h and it fixed that.
And this BLE-Mouse library,which also fixed the esp32 HID problems.
I use a code, what i found on this site and made some modification.

#include <BleMouse.h>
#include <ps2.h>

#define PS2_DATA 10
#define PS2_CLK 9

byte mstat1;
byte mstat2;
byte mxy;
byte mx;                  
byte my;      
byte mz;               
int msval[2];
int repeatCnt;

PS2 moose(PS2_CLK, PS2_DATA);     

BleMouse bleMouse;

void setup() {
  bleMouse.begin();
  moose.write(0xff);  
  moose.read();
  moose.read();
  moose.read(); 
  moose.write(0xf0); 
  moose.read(); 
  delayMicroseconds(100);
  moose.write(0xe8);
  moose.read(); 
  moose.write(0x03);
  moose.read(); 
  moose.write(0xe8);
  moose.read(); 
  moose.write(0x00); 
  moose.read();  
  moose.write(0xe8);
  moose.read();  
  moose.write(0x01);
  moose.read(); 
  moose.write(0xe8);
  moose.read(); 
  moose.write(0x00); 
  moose.read(); 
  moose.write(0xf3);
  moose.read(); 
  moose.write(0x14);
  moose.read(); 
  Serial.begin(9600);
}

void ms_read()
{moose.write(0xeb);
  moose.read();
  mstat1 = moose.read();
  mxy = moose.read();
  mz = moose.read();
  mstat2 = moose.read();
  mx = moose.read();
  my = moose.read();
  msval[0] = (((mstat2 & 0x10) << 8) | ((mxy & 0x0F) << 8) | mx );
  msval[1] = (((mstat2 & 0x20) << 7) | ((mxy & 0xF0) << 4) | my );
  msval[2] = int(mz);
}

void loop() {
  ms_read();
  if (msval[0] > 0 and msval[2] > 10)
  { repeatCnt++; }
  else
  { repeatCnt = 0; }
 
    if (repeatCnt > 2)
  {
    msval[0] = map(msval[0], 580, 5164, -1023, 1023);
    msval[1] = map(msval[1], 1120, 5967, 1023, -1023);
    bleMouse.move(msval[0]/200,msval[1]/200);
  }


}

The code is uploading to the modul but doesn't react to any touch. Maybe i use wrong pins on the esp32 or a wrong ps2 library, i'm not sure.
Thanks to anyone who can help me figure out what is going on here, I really appreciate it. :slightly_smiling_face:

@borsika, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the Installation & Troubleshooting category.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.