Skip to content

leyuzak/JoystickTest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Extreme 3D Pro Joystick Data Read and Control Module

This is an C++ library developed to read data from Extreme 3D Pro Joystick.

Usage

Here is a basic example to use this class:

int main() {
    Joystick* js = new Joystick("/dev/input/js0");

    while(true){
        // js->get_button_state usage
        bool b_1  = js->get_button_state(BUTTON_1);
        bool b_2  = js->get_button_state(BUTTON_2);
        bool b_3  = js->get_button_state(BUTTON_3);
        bool b_4  = js->get_button_state(BUTTON_4);
        bool b_5  = js->get_button_state(BUTTON_5);
        bool b_6  = js->get_button_state(BUTTON_6);
        bool b_7  = js->get_button_state(BUTTON_7);
        bool b_8  = js->get_button_state(BUTTON_8);
        bool b_9  = js->get_button_state(BUTTON_9);
        bool b_10 = js->get_button_state(BUTTON_10);
        bool b_11 = js->get_button_state(BUTTON_11);
        bool b_12 = js->get_button_state(BUTTON_12);
        bool b_L  = js->get_button_state(BUTTON_LEFT);
        bool b_R  = js->get_button_state(BUTTON_RIGHT);
        bool b_U  = js->get_button_state(BUTTON_UP);
        bool b_D  = js->get_button_state(BUTTON_DOWN);

        // js->get_axis_value usage
        float yaw      = js->get_axis_value(YAW);
        float pitch    = js->get_axis_value(PITCH);
        float roll     = js->get_axis_value(ROLL);
        float throttle = js->get_axis_value(SLIDER);
    }
}

As shown above, it is easy to use. To get buttons' value just use get_button_state() method with parameter Button which you want to find out.
Likewise, to get axes value just use get_axis_value() method with parameter Axis.

To get more about Button and Axis, check out below schemas.

Button parameter usage schema Axis parameter usage schema

If you want to use this library, firstly, must download this package.

sudo apt install joystick

And then include into your code.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages