UNDERSTANDING data types

Introduction When declaring a variable, you need to state a data type. A data type determines how much space a variable can occupy in memory and what type of data. Dynamic vs static typing If you come from a background of Java, JavaScript, PHP, Python or Ruby – then this may seem odd. These languages…

random numbers

UNDERSTANDING random numbers in C++

Even though languages have ways of generating numbers, these numbers are not truly random! A more accurate description of what has been generated is a pseudo random number! The very nature of computers and software is such that random behaviour is not a feature that they have. Because we want them to perform set tasks,…

dice

BUILD a rolling LED die

OBJECTIVE The objective of this project is to simulate a rolling die. I will use LEDs arranged in the pattern of a conventional die and give the illusion that it is ‘rolling’ as a number is randomly chosen. THE CODE The first thing that I did was to create and initialise an array, with the…

74165 4021 pinout

BUILD a GPIO extender

The problem There may be occasions when you have a microcontroller that does not have enough GPIO pins for a circuit! Your circuit may require a large number of switches or LEDs, which would use up lots of GPIO pins. It’s likely that you will need some of the GPIO pins for other parts of…

binary

BUILD a binary counter

OBJECTIVE We will build an 8-bit binary counter. This means that it will be able to count from 0 to 255, which in binary is 00000000 to 11111111. An LED that is off will represent a binary 0 and an LED that is on will represent a binary 1. Since computers count in binary, this…

UNDERSTANDING binary

Computers use binary, base 2 and therefore I think that it is very important that you understand what binary is and how to use it. If you understand and build the circuit that I describe here, it can help you to count in binary! Binary uses only two digits, 0 and 1. Each digit is…

BUILD a voltmeter

OBJECTIVE The objective of this project is a build a voltmeter that can measure voltages between 0 and 30V. I will use the analog inputs of an Arduino to measure the voltage, via a voltage divider. When an Arduino is powered from a 5V supply the maximum voltage that could be measured is 5V. However,…

BUILD a thermometer

OBJECTIVE In this project we will build a device for measuring temperature. THE HARDWARE You can use an UNO or MEGA There are a number of sensors that I could have used to make this thermometer but I chose the LM35. I chose the LM35 because of its precision. The LM35 has an output voltage…

BUILD a frequency counter

THE OBJECTIVE Our objective is to build a frequency counter that can identify frequencies up to 1MHz. pulseIn() pulseIn() reads a pulse on a pin and waits for a change from HIGH to LOW or LOW to HIGH. This works with times that are between 10μs and 180s. You can provide either two or three…