Arduino boards are small computers that can read information from a variety of sensors as well as control lights, motors and other electronic components. There are computers in microwaves, inside elevators, and onboard cars which have as many as 70 small Arduino-like computers inside. There are computers practically all around us nowadays. Similar to the Arduino board, many of these computers do not have a keyboard or a screen.
The English alphabet has 26 symbols in lower case plus the same in upper case, as well as 10 symbols for numbers. Unlike humans, computers communicate with 2 symbols; ’0′ and ’1′. This is called “digital signals”. Using combinations of 0s and 1s, digital machines can represent just about everything in the universe.
Human have a total of 10 symbols to represent numbers: from 0 to 9. These can represent an infinite range of numbers. In the same way, just about anything in the universe can be represented with just 1s and 0s. We just need a system to combine them.
During the programming introduction, we learned how to make small programs and animations using the computer. We were turning on and off pixels on the computer screen. As you know, the Arduino board has no screen, but it has an LED – a small lamp that can easily be turned on and off using a program. You could say that the Arduino board comes with a one ‘pixel’ screen.
Let’s play a little bit with sound. As you probably already know, sound is vibrations. The sound from a guitar for example comes from the vibrations of the strings. So to produce sound with an Arduino we need to generate vibrations. In the following experiment we will do this with a piezoelectric buzzer (a piezo), making it beep.
Similar to how you write ’0′ or ’1′ to a pin on Arduino, you can read a value generated by a sensor attached to it. When working with digital pins, we will use digital sensors that can only be ON or OFF.
Play a simplified version of the classic arcade game, Pong!
In this game, a “pong” will move across five LEDs (VU-meter) and bounce back and forth as players press the button. Players must press the button at the right time in order to return the pong.
En garde! Test your reaction time against an opponent!
In this game, two players will hold tilt switch swords. When the green LED randomly lights up, the first person to swing their sword wins.
He shoots! He scores!
In this game, players will try to land a ping pong ball into a cup. Make five points to win. The score is tracked using a light dependent resistor (LDR).
Ready… Set… Go! Test your reaction time!
In this game, one of three LEDs will randomly light up. You must tap the corresponding capacitive sensor as quick as possible. If you don’t react fast enough, the game is over.
Run as fast as you can . . . with your fingers!
In this game, a player must tap two sensors alternately in order to run laps. One LED will light up per lap. When all laps are completed, LEDs will blink in victory.
Now that you know a bit of programming, we are going to step it up and move on to electronics. We will go through the basics of digital technologies that you will need to know in order to make LEDs blink and to read signals from a button. Even though it’s pretty simple to turn an LED on or off, by combining digital components in a creative way you will see that you can make very fun projects. By the end of the week, you will have built small electronic games that simulate sports.
Come on lucky number! Use this digital die next time you play a board game.
You “throw” the die by shaking a tilt sensor. The LEDs will cycle through different numbers, slowing down until it finally stops and reveals the number.
Test your memory with this game!
LEDs will blink in a pattern that you have to remember and repeat. If you get it right, the game gets more and more challenging.