查看“Joypad-Game-Snake”的源代码
←
Joypad-Game-Snake
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{| style="width: 800px;" |- | ==Outline== We adopt Microduino-Joypad-Game to play the game of Snake. ==Bill of Material== *Microduino Equipment {|class="wikitable" |- |Module||Number||Function |- |[[Microduino-Core]]||1||Core |- |[[Microduino-USBTTL]] ||1||Program download |- |[[Microduino-Joypad]] ||1|| |} [[File: Microduino-Joypad-snake.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_Game] ==Debuging == *Step 1: Prepare Microduino-Joypad-Game and you can refer to: [[Microduino-Joypad_Getting_start]] *Step 2: Stack [[Microduino-Core]] and [[Microduino-USBTTL]] on Microduino-Joypad-Game; *Step 3: Download the library and code, and then update the library to compiler【[[Install Arduino IDE Microduino Program Library Support Package]]】 *Step 4: Open 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) Joy=3; else if(Joypad.readButton(CH_SWITCH_4)==0) Joy=2; if(Joypad.readButton(CH_SWITCH_1)==0) Joy=1; else if(Joypad.readButton(CH_SWITCH_3)==0) Joy=4; 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) Joy=0; } else { if(x>280||x1>280) Joy=2;// else if(x<-280||x1<-280) Joy=3;// else if(y<-280||y1<-280) Joy=1; else if(y>280||y1>280) Joy=4; else Joy=0; } </source> Button control is the default setting by turning the right switches to the top. Users can change the way of switch. *Vibration motor control: <source lang="cpp"> Joypad.motor(0);//Close Joypad.motor(X);//0-255 The vibration is adjustable. </source> *You can change color in “colour.h”. Step 5: Compile the code and select the right board and COM port for download after successful compiling. *Experience: **The initialized picture will remind you “Please move to start”. You can move to the right or press the key of “2” to enter the game. **It will show the score after the game is over. |}
返回至
Joypad-Game-Snake
。
导航菜单
个人工具
创建账户
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
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
帮助
常见问题
帮助
工具
链入页面
相关更改
特殊页面
页面信息