GPIO driver for Analog Inputs

Introduction

The GPIO driver for Analog Inputs is used to detect the voltage level of an analog signal on a selected pin. The selected analog pin gets a granularity assigned which determines at what minimum change the Central Core gets notified.


Driver Parameters

The GPIO driver for Analog Inputs has two parameter that have to be configured:

Pin

This is the pin reading the input voltage, any of the GP pins is suitable for this selection if not already used for other drivers.

 Granularity

This is the minimum change from the last notifications value that would trigger sending another notification to the Central Core. This helps us to only wake up and notify when the application specific threshold has been passed. Important values:

  • The Analog In range: 0-4095 (12 bit)

  • The Granularity range: 0-200


Wiring

Example

The GP0 pin is connected to a potentiometer which is acting as a voltage divider in this case. The resistance does not really matter unless it is in the higher range (>10000Ω) to keep the current flow low.

 

Breadboard

Schematic

Used Pins

Used Pins

Description

Used Pins

Description

GP0 (can be any GP pin)

 This pin reads the analog value given by the potentiometer

3.3V 

This pin provides the high level

GND

This pin provides the low level


How to write an App

Navigate to the App Builder and create a new application. You can find the “Analog In” code object under the “Hardware” Tab in the object drop down menu on the left, or you can also use the search bar.

 

 

Drag the “Analog In” Object onto the canvas.

 

 

 Next, locate the “Text” object under the “Interface” tab and drag it onto the canvas.

 

Finally, connect the “State” port from the Analog In Object to the “In” port on the Text Object and save your application.

 


How to create a firmware

Navigate to the Firmware Builder and create a new firmware file.

 

 

Click the “+ Add Hardware” button which will open a modal window. Scroll down in the list to find the “Generic” section and select the “Analog In” hardware option.

Give your device a name and click “Add Device”

 

 

 

 

Next, select the “GPIO” driver under the driver dropdown menu and set the Pin and the Granularity

For this example we select:

  • Pin: GP0

  • Granularity: 50

 

 

You may now save your firmware file and upload it to one of your Builder Bases

 

 

 


Supported Hardware

  • Joysticks

  • Potentiometers

  • Mostly any analog device


Downloads

Apps

Firmware

Assets