停售
停售
停售
停售
商品簡介 |
JOYSTICK是一款搖桿控制Unit,內部集成MEGA328 晶片,工作原理與一般的搖桿遊戲手柄類似,X、Y軸分別對應著兩個10K 的電位器,當搖桿進行動作時,產生相應的模擬信號並向M5Core輸入搖桿的偏移值,Z軸方向則為一個按鈕應用。
內部電路中,搖桿 X 方向連接至 MEGA328 的 A0 管腳,Y 方向連接至 A1 管腳,Z 方向連接至 A2管腳
該 Unit 通過GROVE A接口與M5Core進行通信,I2C地址為0x52
● 開發平台: Arduino, UIFlow(Blockly, Python)
● 2x LEGO 兼容孔
● 遊戲控制器
● 機器人遠程控制
商品規格 |
規格 | 參數 |
X.Y軸範圍 | 10-250 |
Z軸輸出值 | 0-1 |
淨重 | 11g |
產品尺寸 | 48x 24x 32 (mm) |
電路圖 |
EasyLoader |
M5StickC/V/T/ATOM系列可免驅動使用)
管腳映射 |
M5Core(GROVE A) | GPIO22 | GPIO21 | 5V | GND |
JOYSTICK Unit | SCL | SDA | 5V | GND |
Mega328 ISP下載接口Pin腳定義
範例程序 |
1.Arduino IDE
2.UIFlow
如何查詢I2C位址 |
STEP 1. 將欲查詢的模組連接至Arduino UNO(附圖為腳位參考,實際請比對商品標示接線)
STEP 2. 開啟Arduino IDE並新增檔案
STEP 3. 貼入教學下方的範例文件,並上傳到Arduino UNO,即會開始掃描I2C位址
STEP 4. 開啟序列埠監控視窗,即可取得I2C位址
/ ---------------------------------------------------------------- / | |
// Arduino I2C Scanner | |
// Re-writed by Arbi Abdul Jabbaar | |
// Using Arduino IDE 1.8.7 | |
// Using GY-87 module for the target | |
// Tested on 10 September 2019 | |
// This sketch tests the standard 7-bit addresses | |
// Devices with higher bit address might not be seen properly. | |
/ ---------------------------------------------------------------- / | |
#include |
|
void setup() | |
{ | |
Wire.begin(); // Wire communication begin | |
Serial.begin(9600); // The baudrate of Serial monitor is set in 9600 | |
while (!Serial); // Waiting for Serial Monitor | |
Serial.println("\nI2C Scanner"); | |
} | |
void loop() | |
{ | |
byte error, address; //variable for error and I2C address | |
int nDevices; | |
Serial.println("Scanning..."); | |
nDevices = 0; | |
for (address = 1; address < 127; address++ ) | |
{ | |
// The i2c_scanner uses the return value of | |
// the Write.endTransmisstion to see if | |
// a device did acknowledge to the address. | |
Wire.beginTransmission(address); | |
error = Wire.endTransmission(); | |
if (error == 0) | |
{ | |
Serial.print("I2C device found at address 0x"); | |
if (address < 16) | |
Serial.print("0"); | |
Serial.print(address, HEX); | |
Serial.println(" !"); | |
nDevices++; | |
} | |
else if (error == 4) | |
{ | |
Serial.print("Unknown error at address 0x"); | |
if (address < 16) | |
Serial.print("0"); | |
Serial.println(address, HEX); | |
} | |
} | |
if (nDevices == 0) | |
Serial.println("No I2C devices found\n"); | |
else | |
Serial.println("done\n"); | |
delay(5000); // wait 5 seconds for the next I2C scan | |
} |
出貨清單 |