XInput Bluetooth

Hello everyone.

I have been working on making a custom controller using Arduino and the XInput library. The problem I am running into at the moment is receiving data sent through my bluetooth module in a meaningful format.

#include <XInput.h>

const int Pin_ButtonA = 0;

void setup() {
  Serial3.begin(9600);  

  pinMode(Pin_ButtonA, INPUT_PULLUP);

  XInput.setAutoSend(false);

  XInput.begin();
  }

void loop() {
  boolean buttonA = !digitalRead(Pin_ButtonA);
  XInput.setButton(BUTTON_A, buttonA);

  char Output = XInput.send();
  Serial3.write(Output);
}

This is the simple code I have so far to read a button press and then send it over Serial 3.
Any information that you have would be greatly appreciated.

Edit: I have tried a couple things since making this post. I realized the project I want to make will be powered independently from a computer. Now the output of the micro controller are reverse question marks. Here is a picture of the new output:
image

Each question mark represents when I press down on the button and when I release the button, so I pressed and released the button three times in the above picture.

What about using

   Serial3.print(Output, HEX);

instead of the

    Serial3.write(Output);

call to display the output byte as a human readable hex code instead?

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