Final Project — The Claw Machine

Sia Chang
3 min readDec 9, 2020

For the final project, I want to create a digital claw machine by integrating the digital interface in p5js with physical control interfaces controlled by Arduino.

Ideally, the player can use the joystick and a press button to control the claw and catch the toys in the digital interface. I’ll first create the digital interface using only the keys on the laptop, and after all the functions are successfully implemented, I’ll then connect the physical units.

The claw machine should have the following functions:
1) The claw can move horizontally within certain boundaries.

2) The claw will drop can try to catch a toy below it.

3) Once the claw catches a toy, the toy should move with the claw, and being dropped once the claw goes back to its original position and releases.

4) There should be different game screens indicating the beginning and end of the game.

The First Week

During the first week, I mainly focused on creating digital interfaces. I first started by placing a square and a circle as the prototype for the claw and the toy. To control the claw, I chose to use the left and right arrow keys for now before I connect to the physical interfaces. I also set the boundaries for the claw so it can not go beyond the screen range horizontally.

As for the most important feature of a claw machine, releasing the claw and catch the toy, I was stuck with creating this animation by pressing a button only once.

The Second Week

For the second week, I focused on completing the claw movements, creating the timer and scoring board, and changing the prototype into finalized images.

Since I still couldn't figure out how to create the entire movement for the claw to catch, I changed it into using the space key to control the up and down movement for the claw. So now, the user drops the claw by pressing the space bar and retrieve the claw simply by releasing the space bar.

To make complete the claw machine game experience, I also added the classical background music which plays automatically when the game starts.

The Compromise

As mentioned previously, my original idea was to use a joystick and a button connected through Arduino to act as the physical interface to control the claw machine. However, I was suggested to first focuses on merely the digital part of the project and not worry about the physical part until the digital part is completely figured out. Unfortunately, I couldn’t code the claw move the way I imagined, which lead to the compromise on the physical side, therefore eventually only use the digital control interface.

Sign up to discover human stories that deepen your understanding of the world.

No responses yet

Write a response