Difference between revisions of "Microduino-Joypad Getting start"
From Microduino Wiki
(→扩展功能) |
|||
Line 2: | Line 2: | ||
|- | |- | ||
| | | | ||
− | == | + | ===硬件搭建=== |
+ | **步骤一:将Microduino-TFT安装在Microduino-Joypad面板上; | ||
+ | [[File:Microduino_Joypad_TFT.jpg||600px|center|thumb]] | ||
+ | |||
+ | **步骤二:将尼龙螺丝安装在Microduino-Joypad上,并且将底面板粘贴在Microduino-Joypad底部; | ||
+ | [[File:Microduino_Joypad_nilong.jpg||600px|center|thumb]] | ||
+ | |||
+ | **步骤三:将Microduino-TFT与Microduino-Joypad通过转接线连接起来; | ||
+ | [[File:Microduino_Joypad_.jpg||600px|center|thumb]] | ||
+ | |||
+ | **步骤四:将电池盒连接到底板上,注意正负极别接反了,板子背面标注了正负极; | ||
+ | [[File:Microduino_Joypad_power_1.jpg||600px|center|thumb]] | ||
+ | |||
+ | **步骤六:将Microduino-USBTTL、Microduino-Core叠加在Microduino-Joypad底座上。 [[File:Microduino_Joypad_Module-1.jpg||600px|center|thumb]] | ||
+ | |||
+ | **步骤七:将底板和面板用尼龙螺丝固定好; | ||
+ | [[File:Microduino_Joypad_face_bord-1.jpg||600px|center|thumb]] | ||
+ | |||
+ | **步骤八:你可以打开电源开关,观察供电是否正常。 | ||
+ | [[File:Microduino_Joypad_switch.jpg||600px|center|thumb]] | ||
+ | |||
+ | ==测试== | ||
*两个并列的Upin27底座; | *两个并列的Upin27底座; | ||
*两个波动开关; | *两个波动开关; | ||
Line 15: | Line 36: | ||
[[File:Microduino-Joypad-Expansion.png|600px|thumb|center|Microduino-Joypad-Expansion]] | [[File:Microduino-Joypad-Expansion.png|600px|thumb|center|Microduino-Joypad-Expansion]] | ||
− | ==程序说明== | + | *用到的库: |
+ | **https://github.com/wasdpkj/libraries 你需要用到_01_Microduino_TFT库和_08_Microduino_Shield_Joypad库 | ||
+ | *调试: | ||
+ | **所需要准备的硬件有:Microduino USBTTL、、Microduino Core、组装好的Microduino-Joypad | ||
+ | **准备的软件有:支持的库文件、Arduino IDE; | ||
+ | **解压下载库文件,将解压后的库文件拷贝到Arduino IDE 的libraries文件夹中; | ||
+ | ***重新打开“Arduino-IDE”,,编译通过后,板卡选择Microduino Core (Atmega328P@16M,5V),你可以选择“”_08_Microduino_Shield_Joypad\examples里面的事例,直接下载即可; | ||
+ | ===程序说明=== | ||
*读取: | *读取: | ||
**读取光照、麦克风,扩展接口A、B的值,返回值为:int(0~1023); | **读取光照、麦克风,扩展接口A、B的值,返回值为:int(0~1023); | ||
Line 88: | Line 116: | ||
“unsigned int motor_vol”:振动强弱 | “unsigned int motor_vol”:振动强弱 | ||
</source> | </source> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|} | |} |
Revision as of 15:06, 13 November 2014
硬件搭建
测试
程序说明
//光照----------------------
Joypad.readLightSensor();
//麦克风--------------------
Joypad.readMicrophone();
//INTA----------------------
Joypad.readIntA();
//INTB----------------------
Joypad.readIntB();
//左模拟摇杆----------------
Joypad.readJoystickX();
Joypad.readJoystickY();
//右模拟摇杆----------------
Joypad.readJoystick1X();
Joypad.readJoystick1Y();
Joypad.readButton(byte ch);
//左模拟摇杆----------------
JOYSTICK_UP;
JOYSTICK_DOWN;
JOYSTICK_LEFT;
JOYSTICK_RIGHT;
//左模拟摇杆按下------------
CH_JOYSTICK_SW
//右模拟摇杆----------------
JOYSTICK1_UP;
JOYSTICK1_DOWN;
JOYSTICK1_LEFT;
JOYSTICK1_RIGHT;
//右模拟摇杆按下------------
CH_JOYSTICK1_SW
//拨档开关------------------
CH_SWITCH_L;
CH_SWITCH_R;
//四组按键------------------
CH_SWITCH_1;
CH_SWITCH_2;
CH_SWITCH_3;
CH_SWITCH_4;
//==========================
//蜂鸣器---------------------
Joypad.tone(unsigned int freq);
Joypad.tone(unsigned int freq, unsigned long duration);
Joypad.noTone();
//振动------------------------
Joypad.motor(unsigned int motor_vol);
“unsigned int motor_vol”:振动强弱 |