mraa  2.0.0
Low Level Skeleton Library for Communication on GNU/Linux platforms
Public Member Functions | List of all members
Aio Class Reference

Detailed Description

This file defines the aio interface for libmraa

import mraa.Aio;
public class AioA0 {
static {
try {
} catch (UnsatisfiedLinkError e) {
"Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" +
public static void main(String[] args) {
Aio a0 = new Aio(0);
for (int i = 100; i > 0; --i) {
int adc_value =;
float adc_value_float = a0.readFloat();
System.out.println(String.format("ADC A0 read %X - %d", adc_value, adc_value));
System.out.println(String.format("ADC A0 read %.5f", adc_value_float));

Public Member Functions

synchronized void delete ()
 Aio (int pin)
long read ()
float readFloat ()
Result setBit (int bits)
int getBit ()

Constructor & Destructor Documentation

Aio ( int  pin)

Aio Constructor, takes a pin number which will map directly to the board number

pinchannel number to read ADC inputs

Member Function Documentation

int getBit ( )

Gets the bit value mraa is shifting the analog read to.

bit value mraa is set return from the read function
long read ( )

Read a value from the AIO pin. By default mraa will shift the raw value up or down to a 10 bit value.

std::invalid_argumentin case of error
The current input voltage. By default, a 10bit value
float readFloat ( )

Read a value from the AIO pin and return it as a normalized float.

std::invalid_argumentin case of error
The current input voltage as a normalized float (0.0f-1.0f)
Result setBit ( int  bits)

Set the bit value which mraa will shift the raw reading from the ADC to. I.e. 10bits

bitsthe bits the return from read should be i.e 10
mraa::Result type

The documentation for this class was generated from the following file: