UPM

The UPM API is a high level sensor library for IoT devices using MRAA. See examples here. Back to index page.
SparkFun sensor images provided under CC BY-NC-SA-3.0.

Joystick12 Class

Module: joystick12
  • ID: joystick12
  • Name: 2-axis Analog Joystick
  • Category: ainput
  • Manufacturer: generic
  • Connection: analog
  • Kit: robok

This module defines the Joystick API, and implementation for the X and Y buttons could be treated as normal GPIO - this enables easier interrupt support. This driver should be compatible with any 2-axis analog joystick.
joystick12.jpg

Item Index

Methods

Joystick12

(
  • pinX
  • pinY
)
Number

Instantiates a Joystick object

Parameters:

  • pinX Number

    Analog pin where the X input is connected

  • pinY Number

    Analog pin where the Y input is connected

Returns:

Number:

getXInput

() Number

Gets the X input

Returns:

Number:

float X value, ranging from -1 to 1; 0 is mid

getYInput

() Number

Gets the Y input

Returns:

Number:

float Y value, ranging from -1 to 1; 0 is mid