查看“Joypad-Game-Tetris”的源代码
←
Joypad-Game-Tetris
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{| style="width: 800px;" |- | ==Outline== Use Microduino-Joypad-Game to play Tetris. ==Bill of Material== *Microduino Equipment {|class="wikitable" |- |Module||Number||Function |- |[[Microduino-Core]]||1||Core board |- |[[Microduino-USBTTL]] ||1||Program download |- |[[Microduino-Joypad/zh]] ||1|| |} [[File: Microduino-Joypad-teril.jpg|600px|center|thumb]] ==Download== TFT library:https://github.com/Microduino/Microduino_Tutorials/tree/master/Microduino_Libraries/_01_Microduino_TFT_ST7735 Joypad lib.:https://github.com/Microduino/Microduino_Tutorials/tree/master/Microduino_Libraries/_08_Microduino_Shield_Joypad Code:https://github.com/Microduino/Microduino_Tutorials/tree/master/Microduino_Joypad/Microduino_JoyPad_Game/Microduino_JoyPad_teril ==Debugging== *Step: Prepare Microduino-Joypad-Game and you can check: [[Microduino-Joypad_Getting_start]] *Step 2: Stack [[Microduino-Core]] and [[Microduino-USBTTL]] on the panel of Microduino-Joypad-Game; *Step 3: Download all the libraries and codes needed and then update the library to the compiler 【[[Install Arduino IDE Microduino Program Library Support Package]]】 *Step 4: Open the program example **Switch the code of the joystick and the button control: <source lang="cpp"> if(Joypad.readButton(CH_SWITCH_R)) { if(Joypad.readButton(CH_SWITCH_2)==0) joyx=100; else if(Joypad.readButton(CH_SWITCH_4)==0) joyx=-100; if(Joypad.readButton(CH_SWITCH_1)==0) joyy=-100; else if(Joypad.readButton(CH_SWITCH_3)==0) joyy=100; else if(Joypad.readButton(CH_SWITCH_1)==1&&Joypad.readButton(CH_SWITCH_2)==1&&Joypad.readButton(CH_SWITCH_3)==1&&Joypad.readButton(CH_SWITCH_4)==1) { joyx=0; joyy=0; } } else { joyx = map(Joypad.readJoystickX(), -280, 300, 100, -100); joyy = map(Joypad.readJoystickY(), -300, 230, -100, 100); } </source> Button control is the default setting by turning the left and the right switches to the top. So, the opposite operation is gravity induction control. Users can change the setting according to personal needs. *Vibration motor control: <source lang="cpp"> Joypad.motor(0);//Close Joypad.motor(X);//0-255 Vibration can be adjusted </source> *Buzzer <source lang="cpp"> digitalWrite(speak,LOW);//Close digitalWrite(speak,HIGH);//Open </source> Step 5: Compile the code and select the right board and COM port for download. After that, you can start to play. The sore is on the right top. Users can also try to use gravity induction control according to individual needs. |}
返回至
Joypad-Game-Tetris
。
导航菜单
个人工具
创建账户
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
Welcome
首页
创客大赛
大赛详情
3D打印
安装月球车
图形化编程
操控月球车
升级月球车
编程工具下载
软件下载
Arduino
Processing
Mixly
Scratch
模块套件
Microduino 102
mCookie 102
mCookie 202
mCookie 302
IBC
其他
应用套件
四轴飞行器
平衡车
小车CUBE
音乐播放器
刷卡音乐播放器
wifi气象站
彩虹音乐触摸灯
分贝检测仪
迎门汇报
LED点阵时钟
LED点阵屏幕
硬件
mCookie
Sensor
Microduino
MicroWrt
MicroNux
MicroRobot-Core
MicroRobot-CoreESP
ideaBoard
ideaBox
MicroMV
MicroAI
帮助
常见问题
帮助
工具
链入页面
相关更改
特殊页面
页面信息