Category: Really Getting Started With Arduino

  • One Circuit, a Thousand Behaviours

    The great advantage of programmable electronics over classic electronics now becomes evident: I will show you how to implement many different “behaviours” using the same electronic circuit as in the previous section, just by changing the software. As I’ve mentioned before, it’s not very practical to have to hold your finger on the button to…

  • How Does This Work?

    We have introduced two new concepts with this example program: functions that return the result of their work, and the if statement. The if statement is possibly the most important instruction in a programming language, because it allows a computer (and remember, the Arduino is a small computer) to make decisions. After the if keyword, you have to write a “question”…

  • Using a Pushbutton to Control the LED

    Blinking an LED was easy, but we don’t think you would stay sane if your desk lamp were to continuously blink while you were trying to read a book. Therefore, you need to learn how to control it. In the previous example, the LED was your actuator, and the Arduino was controlling it. What’s missing…

  • What Is Electricity?

    If you have done any plumbing at home, electronics won’t be a problem for you to understand. To understand how electricity and electric circuits work, the best way is to use something called the water analogy. Let’s take a simple device, like the battery-powered portable fan shown in Figure 4-3. If you take a fan apart, you will see…

  • What We Will Be Building

    I have always been fascinated by light and the ability to control different light sources through technology. I have been lucky enough to work on some interesting projects that involve controlling light and making it interact with people. Arduino is really good at this. We will be working on how to design interactive lamps, using Arduino…

  • The Code, Step by Step

    At first, you might consider this kind of explanation too unnecessary, a bit like when I was in school and I had to study Dante’s Divina Commedia (every Italian student has to go through that, as well as another book called I promessi sposi, or The Betrothed—oh, the nightmares). For each line of the poems, there were a hundred lines…

  • Real Tinkerers Write Comments

    Any text beginning with // is ignored by Arduino. These lines are comments, which are notes that you leave in the program for yourself, so that you can remember what you did when you wrote it, or for somebody else, so they can understand your code. It is very common (we know this because we do it all…

  • Arduino Is Not for Quitters

    Arduino always expects that you’ve created two functions: one called setup() and one called loop(). setup() is where you put all the code that you want to execute once at the beginning of your program, and loop() contains the core of your program, which is executed over and over again. This is done because Arduino is not like your regular computer—it…

  • Pass Me the Parmesan

    Notice the presence of curly braces, which are used to group lines of code together. These are particularly useful when you want to give a name to a group of instructions. If you’re at dinner and you ask somebody, “Please pass me the Parmesan cheese,” this kicks off a series of actions that are summarised…

  • Blinking an LED

    The LED blinking sketch is the first program that you should run to test whether your Arduino board is working and is configured correctly. It is also usually the very first programming exercise someone does when learning to program a microcontroller. A light-emitting diode (LED) is a small electronic component that’s a bit like a lightbulb, but…