Josh Ng's Coding Projects

Hi, I am Josh Ng, and I love exploring robotics and block‑based coding. I enjoy solving problems by building creative projects that mix hardware and code. My projects range from designing robots using LEGO Technic parts to programming sensors with block‑based code!

Portrait of Josh Ng

Project 1: Bumper Track Car

Bumper Track Car

I learnt how to use the LEGO technic parts to create different designs. Using the coding concept of conditionals (if-else), together with different sensors, I coded my designs to do certain actions only if a specific condition is met. Among the many projects I have made, one of my favourites is a bumper car that reverses when the touch sensor in the front hits the wall.

Project 1: Bumper Track Car
Project 2: Escalator with Motor Sensors
Project 2: Escalator with Motor Sensors

Escalator with Motor Sensors

Using motor as a sensor, I created an escalator that moves when the motor reading is less than 0 and stops if the reading is more than 0. This is similar to an emergency-controlled lever.

Project 3: Touch & Ultrasonic Sensor Geared Car

Touch & Ultrasonic Sensor Geared Car

I wanted to create an automatic geared car similar to one on the racetracks. I decided to use the coding concepts of while loops and design skills to create a car that moves only when the touch sensor is activated. It will stop immediately when the ultrasonic sensor detects someone in front and this distance with a specific threshold is determined by me.

Project 3: Touch & Ultrasonic Sensor Geared Car
Project 4: Geared Teacup Ride
Project 4: Geared Teacup Ride

Geared Teacup Ride

I love going to the amusement park and taking the spinning top ride whose speed is usually human operated. I decided to recreate the ride using LEGO technic parts and coded it to move when it is activated by colour sensor 1. I could control the direction it spins using colour sensor 2 by determining the values.

Project 5: Lego Chandelier

Lego Chandelier

The chandelier in my house is stationary and works only as a light source. I decided to create one that could also move. Using the concepts of nested while loops and the and function, the chandelier will spin when the motor reading of the motor is less than zero. It will stop when 2 conditions are met. When ultrasonic sensor detects someone and colour sensor detects blue, the chandelier will stop. This acts like an emergency stop function. It is then activated to move again with the motor lever.

Project 5: Lego Chandelier
Project 6: Geared Windmill
Project 6: Geared Windmill

Geared Windmill

I love to see windmills whenever I go overseas. I wanted to create a windmill whose speed could be controlled using the touch and colour sensor. With the coding concepts of variables and if else, the blades of the windmill increase speed if the colour sensor detects a value and decreases speed if the touch sensor is activated.

Divisibility Tester (divisibility_tester.py)

Description:

I have built a Python module named **divisibility_tester.py** to check if a user-input number is divisible by both 3 and 5 using floor division and modulo.

Diagram:

Diagram for Divisibility Tester

Trinket:

Leap Year Checker (leap_year.py)

Description:

This program checks if a given year is a leap year by using if-else statements to handle divisibility by 4, 100, and 400. It demonstrates how to make decisions in code based on multiple conditions.

Diagram:

leap_year.png

Trinket:

Movie Theatre Ticketing System (movie_ticketing.py)

Description:

I designed a simple movie theatre ticketing system that uses if-else statements to determine the ticket price based on the age of the customer. If the customer is under 18, they get the child ticket price, else they get the adult ticket price.

Diagram:

Diagram for Movie Theatre Ticketing System

Trinket:

Simple Temperature Classification System (temperature_classification.py)

Description:

I designed a weather application. I developed a Python program that takes in the user's input for the current temperature in Celsius and classifies it into different categories: "Freezing," "Cold," "Moderate," and "Hot."

Diagram:

Diagram for Simple Temperature Classification System

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: