-
Notifications
You must be signed in to change notification settings - Fork 5
Programming the arduino
The wordclock is powered by an arduino nano. We choose the nano because of the price and the small form factor.
-
To compile and upload the code you will need the Arduino IDE. You can download it directly from the Arduino website : https://www.arduino.cc/en/Main/Software
-
(Optional) If you want to edit the code, a simple text editor will be enough but I recommend to use Atom.io (free) or any other C++ editor so you have a minimum of code highlight.
You can either clone the github repository if you're familiar with git or you can simply download an archive of the repos.
-
Connect the arduino using an USB cable.
-
Open the file software/wordclock/wordclock.ino with the Arduino IDE.
-
Select the board Arduino nano (see screenshot below). If the board is not available, use the Board manager to download it.
-
Select the processor ATmega328
-
Select the good COM port (sometimes the name of the board will be display next to the COM port number, if not, it's not really an issue)
-
Click on the "arrow right* icon (upload). This will compile then upload the code on your arduino board.
By default the layout is in french. But maybe you're using a different language or you have made a custom layout. The layout files that we provide are in the folder software/wordclock/layouts. If you want to change the language to english for example just uncomment your language in constant.h as below:
//#define LAYOUT_DE
//#define LAYOUT_FR
#define LAYOUT_EN
If you open the layout.cpp file you can see how it works. Each led has a number (the first one is 0). The leds are arranged in a snake shape. The beginning is at the top left corner. See the first two line for you will quickly understand.
|000|001|002|003|004|005|006|007|008|009|010|011|
|023|022|021|020|019|018|017|016|015|014|013|012|
|024| | | | | | | | | | |035|
|047| | | | | | | | | | |036|
|048| | | | | | | | | | |059|
|071| | | | | | | | | | |060|
|072| | | | | | | | | | |083|
|095| | | | | | | | | | |084|
|096| | | | | | | | | | |107|
|119| | | | | | | | | | |108|
|120| | | | | | | | | | |131|
|143| | | | | | | | | | |132|
If you want to customize the layout, just edit the method
void Layout::getLayout(char hour, char minute, char sec, Display* d)
By default all leds are off, you just have to indicate which led you want to power on.