EasyManua.ls Logo

Seeed BeagleBone Green Wireless - Page 20

Seeed BeagleBone Green Wireless
24 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
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 BBGW, so you don’t need to install
it. However if you want to update the library, or want to upgrade the library, use aptget
update and aptgetupgrade 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
importmraa
importtime
#mraa.gpio60=P9_14=GPIO_50
led=mraa.Gpio(60)
led.dir(mraa.DIR_OUT)
whileTrue:
led.write(1)
time.sleep(1)
led.write(0)
time.sleep(1)
Grove - PIR Sensor
importmraa
importtime
#mraa.gpio73=P9_27=GPIO_115
pir=mraa.Gpio(73)
pir.dir(mraa.DIR_IN)
whileTrue:
print(pir.read())
time.sleep(1)
Grove - Rotary Angle Sensor
importmraa
importtime
#mraa.aio1=AIN0
rotary=mraa.Aio(1)

Related product manuals