Joshua Tung's Coding Projects

My name is Joshua, and I am 12 years old this year. I started learning robotics with LEGO Mindstorms together with block-based coding when I was in Primary 4. I enjoy working on different structures and robots, designing and building them to automate routine daily tasks in my life. Learning robotics helped me solve real-world problems, and I was eager to explore beyond block-based coding. This sparked my interest in learning Python, a text-based programming language. I wanted to write programs to help me solve math problem sums without using pen and paper. I also learned how to use Pygame, where I created different games that my friends could play to compete and challenge one another. I have documented my journey in robotics, coding, innovation, and STEM.

Portrait of Joshua Tung

Project 1: Bumper Car

Bumper Car

I learned how to use LEGO Technic parts to design and build functional mechanical systems. By applying coding concepts such as conditionals (if-else) and integrating sensors, I programmed my creations to respond dynamically to their environment. One example was a bumper car that automatically reverses when its front touch sensor detects a collision. This mimics real-world obstacle detection systems used in autonomous vehicles to enhance safety and navigation.

Project 1: Bumper Car
Project 2: Rack and Pinion Door
Project 2: Rack and Pinion Door

Rack and Pinion Door

I built various mechanical structures using LEGO Technic parts and applied conditional logic (if-else) with different sensors. For this project, I created a rack and pinion automatic door using an ultrasonic sensor. The door opens when a person is detected within a certain distance, just like the automatic sliding doors commonly found in shopping centers. This project demonstrates how sensor technology improves accessibility, convenience, and energy efficiency in real-life buildings.

Project 3: Motor-Controlled Jack-In-The-Box

Motor-Controlled Jack-In-The-Box

Wanting to create a fun toy to prank my siblings, I applied the design principles and coding skills I learned to build a Jack-in-the-Box mechanism. The toy is controlled by a handheld motor that activates the opening and closing of the box. By spinning the motor in a specific sequence of directions, the Jack springs out, demonstrating how programmed mechanical sequences create interactive and entertaining devices similar to automated toys used in consumer products.

Project 3: Motor-Controlled Jack-In-The-Box
Project 4: Touch-Activated Automated Rabbit Head
Project 4: Touch-Activated Automated Rabbit Head

Touch-Activated Automated Rabbit Head

My younger siblings enjoyed playing with their toy rabbit head, which spun when the wind hit it. They used to manually spin and stop it, which was fun but limited. To make it more interactive, I created an automated version. In this upgraded design, the rabbit head spins automatically when the program starts. When the ultrasonic sensor detects someone nearby—such as a child approaching—the spinning stops, and the toy returns to its original position. This project demonstrates how sensors can bring simple toys to life.

Simple Division (simple_division.py)

Description:

This project shows how to calculate the remainder when one number is divided by another. It’s a great way to practice using arithmetic and the modulo operator (%).

Diagram:

simple_division.png

Trinket:

Even/Odd Checker (even_odd_checker.py)

Description:

In this project, I designed a program that checks if a number is even or odd using if-else statements. This project teaches me how to make decisions in code based on conditions.

Diagram:

Diagram for Even/Odd Checker

Trinket:

Prime Number Guesser Game (prime_number_game.py)

Description:

This game challenges you to decide if a number is prime by using if-else statements. It’s a fun way to reinforce the concept of prime numbers and divisibility in code.

Diagram:

prime_number_game.png

Trinket:

Factorial Calculation(factorial_calculator.py)

Description:

I organized a math competition among my friends, and one of the challenges involved calculating the factorial of a given number. I created a Python script that took a user input and calculated the factorial of the given number.

Diagram:

Diagram for Factorial Calculation

Trinket:

Count Vowels and Consonants in a String (count_vowels_consonants.py)

Description:

In this project, I used a for loop to count the number of vowels and consonants in a given string. The loop iterates through each character in the string, checking if it is a vowel or consonant, and updates the counts accordingly.

Diagram:

Diagram for Count Vowels and Consonants

Trinket:

Number Pyramid (number_pyramid.py)

Description:

In this project, I created a number pyramid using nested for loops. The outer loop controls the number of rows, while the inner loop prints the numbers in each row. This project demonstrates how to use loops to create patterns and shapes in Python.

Diagram:

Diagram for Number Pyramid

Trinket:

Word Matrix Diagonal (word_matrix.py)

Description:

In this project, I learned how to create a program that takes in a user input for a choice of word and prints the word diagonally in a square matrix using a nested for loop concept.

Diagram:

Diagram for Word Matrix

Trinket:

Pascal Triangle (pascal_triangle.py)

Description:

In this project, I created a program that uses nested loops concept to build a classic math triangle known where each number is the sum of the two numbers above it.

Diagram:

Diagram for Pascal Triangle

Trinket:

Sum of My Even Numbers (sum_of_my_even_numbers.py)

Description:

I have created a Python script named sum_of_my_even_numbers.py. It prompts me for a positive integer, and using a while loop, it calculates and displays the sum of all even numbers from 2 to the entered integer.

Diagram:

Diagram for sum of even numbers

Trinket:

Countdown Timer (my_countdown_timer.py)

Description:

In this project, I built a countdown timer that uses a while loop to count down from a starting number until it reaches 1. This is important because it shows me how to repeat an action until a condition is met.

Diagram:

Diagram for Countdown Timer

Trinket: