RN42 mouse, horizontal scroll function

Hi, I have done a mouse using a RN42 bluetooth module with HID profile, the input report that I use is this:

Serial.write((byte)0xFD); //Start HID Report
Serial.write((byte)0x5); //Length byte
Serial.write((byte)0x2); //Descriptor byte
Serial.write(BUTTON); //Button byte
Serial.write(X); //(-127 to 127)
Serial.write(Y); //(-127 to 127)
Serial.write((byte)0x00);//Wheel byte (-127 to 127)

but now I want to implement the horizontal scroll function, but I can´t find the way to do it.

Do you know if it’s possible to do that?

thanks.

Hi i don't know if it will help you but i found this library for RN 42 HID.

https://github.com/baselsw/BPLib

why did you put (byte(0x00))?? you need to put some variable integer or a sensor value to make the wheel move.

Hello,

I’m new to Arduino and I would also like to create an HID, but just with a button that activates a mouseclick on my computer via the BlueSMiRF bluetooth chip, which can also be HID enabled and has the RN42 as a part of it.

I still don’t really understand how the system with the input reports yet… Do I implement it correctly like this?

#include <SoftwareSerial.h>

SoftwareSerial bluetoothSerial(2, 3);
const int buttonPin = 4;
int buttonState = 0; 

void setup(){
  Serial.begin(9600);
  bluetoothSerial.begin(9600);
  pinMode(buttonPin, INPUT);
  buttonState = digitalRead(buttonPin);
}

void loop(){
  delay(1000);
  if (bluetoothSerial.available())
  {
    Serial.print((char)bluetoothSerial.read());
  }
  if (Serial.available())
  {
    bluetoothSerial.print((char)Serial.read());
  }
  if (buttonState == HIGH) {
   Serial.write((byte)0xFD); //Start HID Report
   Serial.write((byte)0x5); //Length byte
   Serial.write((byte)0x2); //Descriptor byte
  }
}

I connected the BlueSMiRFs TX to pin 3 on my arduino uno and RX to pin 2.
I tried it through pin 0 and 1 but it somehow didn’t work.

Hope you can help!

Do I implement it correctly like this?

Like this?

void loop(){
  delay(1000);

Absolutely not. Get that stupid delay() out of there.

  if (buttonState == HIGH) {
   Serial.write((byte)0xFD); //Start HID Report
   Serial.write((byte)0x5); //Length byte
   Serial.write((byte)0x2); //Descriptor byte
  }

Does it make sense to you to read the state of the pin that something is connected to only once, when the Arduino resets? It doesn't to me.

I tried it through pin 0 and 1 but it somehow didn't work.

I wouldn't expect the Serial.write() statements to mean anything to the bluetooth device.

What is it you are trying to write() to? What does the data from the blue thing look like? Why are you concerned about sending that data to the same thing you are trying to write() to?