Files

132 lines
3.7 KiB
Markdown
Raw Permalink Normal View History

2020-03-19 21:06:45 +08:00
# Module JOYSTICK
<el-tag effect="plain">SKU:A007</el-tag>
2020-03-19 10:58:07 +08:00
2020-04-08 14:09:44 +08:00
<div class="product_pic"><img src="assets/img/product_pics/module/module_joystick_01.webp"></div>
2019-01-27 19:09:05 +08:00
## Description
2021-01-04 13:23:37 +08:00
**JOYSTICK** is a joystick control panel compatible with the FACE kit. By pushing the joystick on the panel, you can input angle, direction and other data. Using the I2C communication protocol. It's possible to get the offset data of the joystick (X, Y coordinate) and the state of the middle button. An LED bar composed of 12 LEDs is embedded around the joystick. You can customize the luminous form of the LED light according to your needs.
2019-01-27 19:09:05 +08:00
2021-01-29 14:47:53 +08:00
JOYSTICK I2C address is 0x5E by default.
2019-01-27 19:09:05 +08:00
2019-04-26 18:10:14 +08:00
## Product Features
2019-01-27 19:09:05 +08:00
2020-08-17 18:25:21 +08:00
- 4 RGB Led
2021-01-29 14:47:53 +08:00
- I2C communication
2019-01-27 19:09:05 +08:00
- Simple API for programming
## Include
2019-04-26 18:10:14 +08:00
- 1x M5Stack JOYSTICK Module board
- 1x Joystick Bar
2019-01-27 19:09:05 +08:00
2020-05-29 16:36:24 +08:00
## Specification
<table>
<tr style="font-weight:bold">
<td>Resources</td>
<td>Parameter</td>
</tr>
<tr>
2020-11-18 19:00:45 +08:00
<td>Net weight</td>
2020-05-29 16:36:24 +08:00
<td>22g</td>
</tr>
<tr>
<td>Gross weight</td>
<td>50g</td>
</tr>
<tr>
<td>Product Size</td>
<td>58*54*10mm</td>
</tr>
<tr>
<td>Package Size</td>
<td>95*65*25mm</td>
</tr>
</table>
2019-01-27 19:09:05 +08:00
## Related Link
2019-07-11 20:59:31 +08:00
- **[The Firmware of inside MEGA328](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Module/JOYSTICK/firmware_328p/FaceJoystick328)**
2019-01-27 19:09:05 +08:00
2019-06-11 19:20:48 +08:00
## EasyLoader
2019-01-27 19:09:05 +08:00
2020-04-08 14:09:44 +08:00
<img src="https://m5stack.oss-cn-shenzhen.aliyuncs.com/image/EasyLoader_logo.webp" width="100px" style="margin-top:20px">
2019-06-14 17:49:23 +08:00
2020-08-21 14:55:54 +08:00
<a href="https://m5stack.oss-cn-shenzhen.aliyuncs.com/EasyLoader/Module/EasyLoader_FACES_joystick.exe"><el-button type="primary">download EasyLoader</el-button></a>
2019-06-14 17:49:23 +08:00
2020-11-17 16:38:23 +08:00
>1.EasyLoader is a simple and fast program burner. Every product page in EasyLoader provides a product-related case program. It can be burned to the master through simple steps, and a series of function verification can be performed.
2019-06-06 20:01:45 +08:00
>2.After downloading the software, double-click to run the application, connect the M5 device to the computer via the data cable, select the port parameters, and click **"Burn"** to start burning.
2021-01-04 13:23:37 +08:00
>3.The CP210X (USB driver) needs to be installed before the EasyLoader is burned. [Click here to view the driver installation tutorial](en/related_documents/M5Burner#install-usb-driver)
2019-06-11 19:20:48 +08:00
## PinMap
**Mega328 ISP**Download interface Pin foot definition
2020-04-08 14:09:44 +08:00
<img src="assets\img\product_pics\app\mega328_isp.webp" width="30%" height="30%">
2019-06-11 19:20:48 +08:00
## Example
2019-06-06 20:01:45 +08:00
2020-04-24 21:10:31 +08:00
### 1. Arduino IDE
2019-01-27 19:09:05 +08:00
2020-04-30 14:13:25 +08:00
To the complete code `faces_joystick.ino`, click [here](https://github.com/m5stack/M5Stack/tree/master/examples/Face/JOYSTICK)
2019-01-27 19:09:05 +08:00
2020-04-24 21:10:31 +08:00
### 2. UIFLOW
2020-01-07 15:18:15 +08:00
2020-04-08 14:09:44 +08:00
<img src="assets/img/product_pics/base/JOYSTICK.webp" >
2020-01-07 15:18:15 +08:00
2020-01-13 17:23:55 +08:00
- **[UIFlow example](https://github.com/m5stack/M5-ProductExampleCodes/tree/master/Module/JOYSTICK/UIFlow)**
2020-02-11 18:00:45 +08:00
2020-06-18 09:30:41 +08:00
## Function
**Control single RGB**
2021-02-26 17:27:20 +08:00
```clike
2020-06-18 09:30:41 +08:00
/*
Parameter:
indexOfLED: 0 ~ 11
r, g, b: 0 ~ 254
*/
void Led(int indexOfLED, int r, int g, int b){
Wire.beginTransmission(FACE_JOY_ADDR);
Wire.write(indexOfLED);
Wire.write(r);
Wire.write(g);
Wire.write(b);
Wire.endTransmission();
}
```
**Read the offset of each direction**
2021-02-26 17:27:20 +08:00
```clike
2020-06-18 09:30:41 +08:00
void get_joystick_offset(void){
Wire.requestFrom(FACE_JOY_ADDR, 5);
if (Wire.available()) {
y_data_L = Wire.read();
y_data_H = Wire.read();
x_data_L = Wire.read();
x_data_H = Wire.read();
button_data = Wire.read();// Z(0: released 1: pressed)
}
```
<img src="assets/img/product_pics/module/module_joystick_02.webp" width="60%" height="60%">
2021-01-04 13:23:37 +08:00
<el-divider content-position="right">Last updated: 2020-12-28</el-divider>
2020-02-11 18:00:45 +08:00
<script>
var purchase_link = 'https://m5stack.com/collections/m5-module/products/joystick-module';
anchor_search(purchase_link);
scrollFunc();
2021-01-04 13:23:37 +08:00
</script>