Analogue Input

As you learned in the previous section, Arduino is able to detect whether there is a voltage applied to one of its pins and report it through the digitalRead() function. This kind of either/or response is fine in a lot of applications, but the light sensor that we just used is able to tell us not only… Continue reading Analogue Input

Use a Light Sensor Instead of the Pushbutton

Now we’re going to try an interesting experiment using a light sensor2, like the one pictured in Figure 5-5.  As its name suggests, the light-dependent resistor (LDR) is some sort of resistor that depends on light. In darkness, the resistance of an LDR is quite high, but when you shine some light at it, the resistance quickly drops and… Continue reading Use a Light Sensor Instead of the Pushbutton

Introduction

Are the most elementary operations we can do in Arduino: controlling digital output and reading digital input. If Arduino were some sort of human language, those would be two letters of its alphabet. Considering that there are just five letters in this alphabet, you can see how much more work we have to do before… Continue reading Introduction

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… Continue reading One Circuit, a Thousand Behaviours

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”… Continue reading How Does This Work?

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… Continue reading What Is Electricity?