Treehopper Java API
Core classes

These classes are the foundation of Treehopper. More...

Classes

class  io.treehopper.ConnectionService
 Discovers Treehopper boards attached to your device. More...
 
class  io.treehopper.TreehopperUsb
 The core class for communicating with Treehopper USB boards. More...
 
class  io.treehopper.Pin
 A GPIO/Analog pin on the board. More...
 
class  io.treehopper.HardwareSpi
 Built-in SPI peripheral. More...
 
class  io.treehopper.HardwareI2c
 Built-in I2C module. More...
 
class  io.treehopper.HardwareUart
 Built-in UART peripheral. More...
 
class  io.treehopper.HardwarePwm
 Built-in hardware PWM channels. More...
 

Detailed Description

These classes are the foundation of Treehopper.

Many of these classes contain useful code examples and tips on usage.

Important concepts

Assemblies

Except for ConnectionService, all these classes live in the Treehopper.dll assembly (which resides in the Treehopper NuGet package).

Object Construction

In almost all cases, the entire object tree is built for you. For example, you'll never call

Pin pin = new Pin(5); // this makes no sense

Instead, you'll access these objects through the TreehopperUsb object, which you'll obtain from the ConnectionService.Instance. Like so:

TreehopperUsb board = await ConnectionService.Instance.GetFirstDeviceAsync(); // get the first device found
await board.ConnectAsync(); // connect to the board
board.I2c.Enabled = true; // enable the I2C peripheral