Datasheet

BeagleBone_Green_Wireless.md 3/7/2023
20 / 25
Mraa is a C/C++ library with bindings to Python, Javascript and Java to interface with the I/O on Seeed Studio BeagleBone®
Green, Seeed Studio BeagleBone® Green Wireless and other platforms, with a structured and sane API where port
names/numbering matches the board that you are on. Use of Mraa does not tie you to specific hardware with board
detection done at runtime you can create portable code that will work across the supported platforms. UPM is a high level
repository for sensors that use MRAA. Each sensor links to MRAA and are not meant to be interlinked although some
groups of sensors may be. Each sensor contains a header which allows to interface with it. Typically a sensor is represented
as a class and instantiated.The constructor is expected to initialise the sensor and parameters may be used to provide
identification/pin location on the board.
Install and update
Mraaand UPM arealready installed in the system image of Seeed Studio BeagleBone® Green Wireless, so you don't need
to install it. However if you want to update the library, or want to upgrade the library, useapt-get updateand apt-
get upgradeplease. Refer to https://github.com/intel-iot-devkit/mraaand https://github.com/intel-iot-devkit/upmfor
more information.
Mraa Example
light a led
import mraa
import time
#mraa.gpio60 = P9_14 = GPIO_50
led = mraa.Gpio(60)
led.dir(mraa.DIR_OUT)
while True:
led.write(1)
time.sleep(1)
led.write(0)
time.sleep(1)
Grove - PIR Sensor
import mraa
import time
#mraa.gpio73 = P9_27 = GPIO_115
pir = mraa.Gpio(73)
pir.dir(mraa.DIR_IN)
while True:
print (pir.read())
time.sleep(1)
Grove - Rotary Angle Sensor
import mraa
import time
#mraa.aio1 = AIN0
rotary = mraa.Aio(1)
while True: