Skip to content

Megajoy Seperate Digital Input pins #73

@P8Enthusiast

Description

@P8Enthusiast

I want to make a Button box along with the joystick, but for the button box, i would like to add certain code to certain amount of pins (i.e if statement for turning on an LED when the button is HIGH etc) However, when i checked the code, I don't exactly understand how to digital pins are "read" and send to xplane

Image

for (int i = 2; i < 54; i++){
controllerData.buttonArray[(i - 2) / 8] |= (!digitalRead(i)) << ((i - 2) % 8);
}

Is there another way to read from the digital pins where I can add some code to each pin

I saw on the unojoy code that this was possible, but idk how to do this on the megajoy

(this is regarding megajoy)

And also if anyone could explain, why is the button in an array?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions