Objective
Control the kitty’s movement through Joystick.
Principle
Read X-axis and Y-axis simmulation values of Joystick and control kitty’s movement in all directions according to different values.
Equipmemt
Hardware Buildup
- Setup 1:Stack CoreUSB and Sensorhub
- Setup 2:Connectt Joystick to analog port A0 and A1. There is pin description on two sides of Sensorhub, to which you can connect sensors correspondingly.
Software Debugging
- Setup 1:Build Scratch programming environment.
- Setup 2:Start programming. Example program download: 文件:Move Cat.zip
- Setup 3:Code description—Detect values of Joystick for one part and the kitty will make correspsonding movement according to the values.
- You need to create two variables to save Joystick data.
- Move the kitty according to two variables.
Result
Move around the Joystick and you can see corresponding movement of the kitty on Scratch.
Video
|