You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/en/units/joystickv2.rst
+37-14Lines changed: 37 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
JoystickV2Unit
3
3
==============
4
4
5
-
.. include:: ../refs/unit.joystickv2unit.ref
5
+
.. include:: ../refs/unit.joystickv2.ref
6
6
7
7
The joystick is an input unit for control, utilizing an I2C communication interface and supporting three-axis control signals (X/Y-axis analog input for displacement and Z-axis digital input for key presses). It is ideal for applications like gaming and robot control.
8
8
@@ -41,7 +41,7 @@ Constructors
41
41
42
42
.. class:: JoystickV2Unit(i2c, address)
43
43
44
-
Initialize the JoystickV2 Unit.
44
+
Initialize the JoystickV2 Unit.
45
45
46
46
:param I2C i2c: I2C port to use.
47
47
:param int address: I2C address of the JoystickV2 Unit.
@@ -58,6 +58,7 @@ Methods
58
58
59
59
Invert the X-axis of the joystick.
60
60
61
+
61
62
:param bool invert: Whether to invert the X-axis.
62
63
63
64
UIFLOW2:
@@ -68,6 +69,7 @@ Methods
68
69
69
70
Invert the Y-axis of the joystick.
70
71
72
+
71
73
:param bool invert: Whether to invert the Y-axis.
72
74
73
75
UIFLOW2:
@@ -78,6 +80,7 @@ Methods
78
80
79
81
Swap the X-axis and Y-axis of the joystick.
80
82
83
+
81
84
:param bool swap: Whether to swap the X-axis and Y-axis.
82
85
83
86
UIFLOW2:
@@ -88,6 +91,8 @@ Methods
88
91
89
92
Read the ADC value of the joystick.
90
93
94
+
:return (tuple): Returns a tuple of the X-axis and Y-axis ADC values, from 0 to 65535
95
+
91
96
92
97
UIFLOW2:
93
98
@@ -97,6 +102,8 @@ Methods
97
102
98
103
Read the button status of the joystick.
99
104
105
+
:return (bool): Returns the button status. True if pressed, False if not pressed.
106
+
100
107
101
108
UIFLOW2:
102
109
@@ -106,6 +113,7 @@ Methods
106
113
107
114
Set the RGB LED color of the joystick.
108
115
116
+
109
117
:param int r: The red value (0-255).
110
118
:param int g: The green value (0-255).
111
119
:param int b: The blue value (0-255).
@@ -118,20 +126,25 @@ Methods
118
126
119
127
Get the RGB LED color of the joystick.
120
128
129
+
:return (tuple): Returns a tuple of the RGB LED color values.
0 commit comments