Mathieu Leclerc
Mathieu Leclerc

Reputation: 41

Adafruit Feather BLE 32U4

Been messing around with arduino's for a while now, but im fairly new to bluefruit/bluetooth devices.

I am currently working on converting a PS/2 ballmouse from PS2 to USB/Bluetooth. I have the USB portion working perfectly, and i have the mouse click working fine with Bluetooth but for the life of me i can get my mouse mouvement working on bluetooth. Can anyone help??

Keep in mind the Bottom mouse clicks work. Just not the mouvement. The data.position classes do work fine when connected to USB

void controlWired(MouseData data) {
  // Mouve Mouse  
  Mouse.move(data.position.x, (data.position.y * -1), (data.wheel * -1));
  // Mouse Click
  (data.lClick) ? Mouse.press(MOUSE_LEFT) : Mouse.release(MOUSE_LEFT);
  (data.rClick) ? Mouse.press(MOUSE_RIGHT) : Mouse.release(MOUSE_RIGHT);
  (data.wClick) ? Mouse.press(MOUSE_MIDDLE) : Mouse.release(MOUSE_MIDDLE);
}

void controlBLE(MouseData data) {
  // Mouve Mouse  
  if (data.position.x != 0 or data.position.y != 0  or data.wheel != 0){
      //String mouvement = String(data.position.x) + "," + String((data.position.y * -1)) + "," + String((data.wheel * -1));
      ble.print(F("AT+BleHidMouseMove="));
      ble.print(data.position.x);
      ble.print(",");
      ble.print((data.position.y * -1));
      ble.print(",");
      ble.print((data.wheel * -1));
      ble.print(",0");
  }
  // Mouse Click
  (data.lClick) ? ble.sendCommandCheckOK(F("AT+BleHidMouseButton=L,press")) : ble.sendCommandCheckOK(F("AT+BleHidMouseButton=0"));
  (data.rClick) ? ble.sendCommandCheckOK(F("AT+BleHidMouseButton=R,press")) : ble.sendCommandCheckOK(F("AT+BleHidMouseButton=0"));
  (data.wClick) ? ble.sendCommandCheckOK(F("AT+BleHidMouseButton=C,press")) : ble.sendCommandCheckOK(F("AT+BleHidMouseButton=0"));
}

Upvotes: 0

Views: 84

Answers (1)

Mathieu Leclerc
Mathieu Leclerc

Reputation: 41

Never Mind, Found my issue ble.print(",0"); should have been ble.println(",0");

Upvotes: 1

Related Questions