Private
Public Access
2
0

examples: Cleanup Python examples

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Manivannan Sadhasivam
2018-01-30 11:32:18 +05:30
committed by Brendan Le Foll
parent c7faa20c14
commit eda9d03547
15 changed files with 243 additions and 112 deletions

View File

@@ -21,14 +21,21 @@
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Example Usage: Reads integer and float value from ADC
import mraa
print (mraa.getVersion())
print(mraa.getVersion())
try:
# initialise AIO
x = mraa.Aio(0)
print (x.read())
print ("%.5f" % x.readFloat())
# read integer value
print(x.read())
# read float value
print("%.5f" % x.readFloat())
except:
print ("Are you sure you have an ADC?")
print("Are you sure you have an ADC?")