4. Installing IDE and Trēo Library

< All Topics

Once all of the hardware is assembled and wired it is time to move on to programming the project. Before we can start programming we need to have the correct development environment and Trēo library. Below are instructions for each unique platform supported by the Trēo system.

Some platforms may have multiple instances of a bus. (E.g. two I2C buses or two UART buses) In order to distinguish which instance of a bus is used with a module, you must provide a port argument when a module is defined in software. The port designators used on each platform are also listed below.

Raspberry Pi (C++ & Python)

Installing the Software

Start by installing the Trēo Software Library for Raspberry Pi. Once installed, it can be used to compile C++ or develop Python 3 programs that use Trēo hardware with the Raspberry Pi. Examples are included in the install package for C++ and Python 3.

  1. Install Raspberry Pi OS or a similar operating system on to your Raspberry Pi.
  2. Install the Trēo software library for Raspberry Pi.

All of the necessary software is now installed on your Raspberry Pi. Some examples are included in the install package for C++ and Python 3.

Programming Language Specifics

C++

When writing C++ programs with the Trēo library, you must include “Treo/NightShade_Treo.h” in your code and link the dynamic Trēo library as well as wiringPi when you compile your code. The the basic command to compile your code is shown below:

g++ -l NightShade_Treo -l wiringPi inputFile.cpp -o outputFile

Python 3

In Python 3, the Trēo library is imported as NightShade_Treo.

import NightShade_Treo

Port Designators

Communication ProtocolPort Number
I2C1
SPI0
UART0
Port Designators for Raspberry Pi

Arduino IDE

Installing the Software

  1. Install Arduino IDE
  2. Install Trēo Software Library for Arduino IDE
  3. Include the NightShade_Treo library from the Tools>Include Library menu.

Port Designations

Communication ProtocolPort Number
I2C0
SPI0
UART0
Port Designators for Arduino IDE

STM32 Nucleo in the Arduino IDE

Installing the Software

  1. Install Arduino IDE
  2. Install Trēo Software Library for Arduino IDE
  3. Install STM32 Cores
  4. Include the NightShade_Treo library from the Tools>Include Library menu.

Port Designations

Communication ProtocolPort Number
I2C0
SPI0
UART0
Port Designators for STM32 Nucleo in the Arduino IDE

Now that the development software is set up we can finally write the software to run the project. Follow along in the next article.

Previous 3. Assembling Your Project
Next 5. Writing Software for Your Project
Table of Contents