Files
mraa/examples/python/aio.py
Thomas Ingleby 170bdd104f spdx: add spdx tags to most files
Large change that removes the duplicated MIT notice withe a spdx tag

Signed-off-by: Thomas Ingleby <thomas.ingleby@intel.com>
2019-05-23 10:09:12 -07:00

25 lines
449 B
Python

#!/usr/bin/env python
# Author: Brendan Le Foll <brendan.le.foll@intel.com>
# Copyright (c) 2014 Intel Corporation.
#
# SPDX-License-Identifier: MIT
#
# Example Usage: Reads integer and float value from ADC
import mraa
print(mraa.getVersion())
try:
# initialise AIO
x = mraa.Aio(0)
# read integer value
print(x.read())
# read float value
print("%.5f" % x.readFloat())
except:
print("Are you sure you have an ADC?")