Including a cross joystick, Me Joystick Module is used to control the moving direction of cart and the interactive video game. Its black ID means that it has an analog port and should be connected to the port with black ID on Makeblock Orion.
● Operating voltage: 5V DC
● Signal node: 2-shaft analog output
● Cross joystick: comprising two potentiometers and a gimbal
● Module size: 51 x 24 x 32 mm (L x W x H)
● White area of module is the reference area to contact metal beams
● The gimbal separates displacement of joystick into horizontal (X) and vertical(Y) components
● Collect analog signal of potentiometer voltage to identify the position of joystick
● Anti-reverse protection – connecting the power supply inversely will not damage IC
● Support mBlock GUI programming, and applicable to users of all ages
● Adopt RJ25 port for easy connection
● Provide pin type ports to support most Arduino Baseboards
The port of Me Joystick Module has four pins, and their functions are as follows:
● Connecting with RJ25
Since the port of Me Joystick Module has black ID, you need to connect the port with black ID on Makeblock Orion when using RJ25 port. Taking Makeblock Orion as example, you can connect to ports No. 6, 7, and 8 as follows:
● Connecting with Dupont wire
When the Dupont wire is used to connect the module to the Arduino UNO Baseboard, its X and Y pins should be connected to analog pin as follows:
Guide to programming
● Arduino programming
If you use Arduino to write a program, the library Makeblock-Library-master should be invoked to control the Me Joystick Module. This program serves to read the X- and Y-axis position and output to the serial port monitor in the cycle of 10 ms through Arduino programming.Function List of Me Joystick Module
|MeJoystick(uint8_t port)||select a port|
|int readX()||Read the X-axis analog output(-490~490)|
|int readY()||Read the Y-axis analog output(-490~490)|
The function of the code segment is to read the value of X- and Y-axis and output the result to serial monitor in the cycle of 10 ms. Upload the code segment to Makeblock Orion, click the serial monitor, and then you will see the running result as follows:We can see that the output data range of the X- and Y-axis is -490~490. When the joystick is released, the output values are within the range 0. When the joystick moves in the direction identified by the arrow on the module, the value increases; and when it moves in the reverse direction, the value decreases.
● mBlock programming
Me Joystick Module supports the mBlock programming environment and its instructions are introduced as follows:
This is the result to make the panda speaking out the X/Y coordinates.
Me Joystick Module contains a cross joystick which comprises two potentiometers and a gimbal. When the joystick is pushed, the resistance of potentiometer changes and its corresponding voltage also changes. The module is supplied with 5V voltage, and the X, and Y voltage are about 2.5V in initial state. When the joystick is pushed in the X or Y direction of the arrow, the voltage readings increase to the maximum 5V. When it is pushed in opposite direction of arrow, the voltage readings decrease to the minimum 0V. Therefore, you can collect the analog signal of potentiometer voltage to identify where the joystick is pushed.