Chapter 4 Pick Apples
In this chapter, we prepare pick apples game. You can use the joystick to pick apples.
Project 4.1 Pick Apples
Now, let’s use Processing and ESP32 board to achieve the game.
Component List
ESP32-WROVER x1
|
GPIO Extension Board x1
|
Breadboard x1
|
|
Joystick x1
|
Jumper M/M x3
|
Circuit
Use Pin36 and Pin39 (A0 and A3) ports to detect the voltage value of two rotary potentiometers inside joystick.
Schematic diagram |
|
Hardware connection |
|
Sketch
Sketch Pick Apples
Use Processing to open Pick_Apples.pde and click Run. If the connection succeeds, the follow will be shown:
You can use the joystick to control the game. When the palm picked the apple, score +20.
If the palm touches the bomb, the score is -20.
At the same time, you need to pick as many apples as possible before the countdown is over.
When the game fails, press space bar to restart the game:






