Main Content

Visualize sorting algorithms with Arduino and LED strip

Feel confused about sorting algorithms? Use LEDs and Arduino to get better understanding about them!

Sorting algorithms are the basic algorithms for beginners who want to learn computer science or programming. But sometimes you will get confused about how these algorithms work. Thus, there are plenty of visualizations of these sorting algorithms for beginners. But there are no visualization methods based on LEDs. Then I decided to implement one with Arduino and a LED strip.

Basic Concept
To implement a sorting algorithm, firstly you need an unsorted array. So I used a built-in random() function to generate an array filled with elements between (0, 30). And they are unsorted. To visualize those numbers, I created a setColor() function to convert a certain number to a RGB array. Then use the RGB array to set the color of a specified LED.”

Link to article