Arduino Installation

Install Arduino

Download the relevant installer for your computer - Windows, Linux or Mac from this page.

On Windows I clicked on the downloaded exe file and agreed to a the recommended settings.

After installation you will find there is an Arduino folder in your Documents. If you opened the Arduino IDE close it for the next step. 

Download Example

Download example zip file and move it to the Documents folder.

Unzip this file. [Right click and choose Extract all]

Move Files

You now have a choice.

If you have previously used Arduino and have previous sketches and libraries then you should copy what you want from the newly extracted ArduinoLoco folder.

You are mainly interested in the arduinoLoco sketch folder and the contents of the libraries.

If this is a new Arduino you can rename ArduinoLoco in documents to Arduino

Open the Example Project

In file Explorer Navigate to

Documents\Arduino\arduinoLoco\ArduinoLoco

And double click on ArduinoLoco.ino - it should have the Arduino IDE icon attached to it. This opens the example in the Arduino IDE.

Select a Board

Click on the Select Board drop down menu and select

4D Systems gen4-ESP...

This tells the Arduino development platform that we are using an ESP32 chip.

It doesn't really matter which board you pick as long as it has an ESP32 chip.

Add the Libraries

This may not be required - probably broke the build by adding includes to sketch

Click on Sketch on the menu bar

Then select Include Library

At the bottom of the list under "Contributed libraries" you will find

  • espressif_esp_jpeg
  • loco
  • lvgl

Compile the Sketch

Compiling the code can take a while the first time and I like to see what is happening. So click File, then Preferences, then check the compile box next to "Show verbose output during" 

Click on the check mark at the top left.

If all goes well you will see a summary of the Sketch size.

You may see some warning messages in the verbose output - usually relating to lvgl - you can ignore these.

Attach Loco to USB port

Use a USB cable (type A to type C) to connect Loco to a spare USB port on your computer.

Click again on the Select a board drop down and look for a new entry in the PORTS table. 

It will look something like

COM8 Serial Port (USB)

The number will vary

Make sure the new entry is selected. You can change it later.

Rebuild and download the sketch

Now click on e right arrow button at the top left.

This re-compiles the code - which should be quicker now - and sends it to Loco where it starts running.

Open the Serial Monitor

The Serial Monitor is a way for your program to send messages back to your PC.

You will use this to help with program development.

Click on Tools > Serial Monitor to open the Serial Monitor window at the bottom of the Arduino IDE. You can resize this window.

You can send message to your program by typing in the Message box followed by Enter.

Two buttons at the top right of the Serial Monitor can be used to

  • Enable/Disable automatic scrolling - useful if you want to freeze the monitor
  • Clear all the old messages

The Loco examples all generate messages as they start up. Take a look at them to get an idea of what normal startup looks like