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

Chapter01_00

GPIO Extension Board x1

Chapter01_01

Breadboard x1

Chapter01_02

Joystick x1

Chapter14_00

Jumper M/M x3

Chapter01_05

Circuit

Use Pin36 and Pin39 (A0 and A3) ports to detect the voltage value of two rotary potentiometers inside joystick.

Schematic diagram

Chapter04_00

Hardware connection

Chapter04_01

Sketch

Sketch Pick Apples

Use Processing to open Pick_Apples.pde and click Run. If the connection succeeds, the follow will be shown:

../../../_images/Chapter04_021.png

You can use the joystick to control the game. When the palm picked the apple, score +20.

../../../_images/Chapter04_031.png

If the palm touches the bomb, the score is -20.

../../../_images/Chapter04_041.png

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:

../../../_images/Chapter04_051.png