Hardware Reference
In-Depth Information
Testing the Arduino system
It's time now to test the Arduino system. Let's do it in the following way:
• First, take off the chip and place it on the Arduino Uno board, which has to be con-
nected to your computer. To remove the chip from the breadboard or the Arduino
Uno board, you can simply use your fingernails or the edge of a knife. Of course,
make sure that there is no power flowing through the chip whenever you remove it
from a board.
• Load the Blink sketch that comes with the Arduino IDE and upload the code to the
board. You should see that the onboard LED is going on and off continuously.
• Now, disconnect the board from your computer and remove the microcontroller.
Put it back on the breadboard and connect the power with the battery pack. You
should see that the LED inserted on the breadboard is going on and off.
If that doesn't work, there are several things you can check. First, make sure that you cor-
rectly wired the different parts of the project according to the schematics. Then, make sure
that the microcontroller has been programmed correctly by checking that the onboard LED
of the Arduino Uno board is blinking.
Now, we can also make a test with the JeeLib library to put the Arduino controller in a
deep sleep mode when it is not active. Indeed, without specifying anything in the code, the
Arduino microcontroller will consume power even if it is not doing anything. We need to
declare specific commands in the code to put Arduino into a low-power sleep mode.
Let's now see the code for this part. We are going to see the most important elements of the
code. You can find the complete code in the GitHub repository of this chapter.
This sketch starts by including the JeeLib library as follows:
#include <JeeLib.h>
To make sure that the Arduino microcontroller is active, we will also make the LED blink.
However, between each change of state of the LED, we will put the microcontroller in a
deep sleep mode. We first have to define the pin of the LED we want to control:
int led_pin = 13;
We also have to start the watchdog, which is necessary to put Arduino in the sleep mode:
Search WWH ::




Custom Search