Programming the Arduino – Memory Management / Part 2

Let’s get started with the second part of the Arduino programming series. This time we’ll be talking about memory management on the Arduino, how to use it and how best to manage it – showing you how to free up memory and guidelines for programming that will help you reduce your memory footprint on the Arduino.

This article requires some basic understanding of memory, datatypes and basic C/C++ programming skills.

Click here to read more..

How to give your Arduino robot eyes!… (Ultrasonic’s really!)

HCSR04_CloseupWhat robotics project doesn’t need eyes? By eyes we’re referring to HC-SR04 Ultrasonic Sensors. We have put together a quick and easy library to get started with using these sensors.

The HC-SR04 is a low cost, easy to use sensor that will measure distance by bouncing ultrasonic sound waves off of obstacles in front of it.¬†Ideal applications for the HC-SR04 is using them for obstacle avoidance systems in your robots/RC cars – This will be quite short post as there isn’t much to it.

Click here to read more..

Arduino – sorting array integers with a bubble sort algorithm

As it happens, I needed to sort an array of integers in ascending order and also find the minimum and maximum number from the array on my Arduino. I decided to knock up a quick bubble sorting function which you can find below.

Bubble sorting is probably one of the easiest and quickest (to write, not actually sort!) algorithms to produce in C. It works by iterating through the array of values comparing pairs and swapping them around if need be, it then performs the same action again until no swapping is needed. You can read more on the Bubble Sorting algorithm by clicking here.

The above Arduino sketch has debug Serial output which should look like the following one uploaded:


This code isn’t limited to the Arduino, there are no special function requirements needed and should work in any C based application. The only thing that you may want to change is finding the size of the array instead of having it static however I did not need this as I knew how many elements I needed.