MEDIATEK LinkIt Smart 7688 Developer's Manual page 61

Hide thumbs Also See for LinkIt Smart 7688:
Table of Contents

Advertisement

pin.write(0)
Then, call
state to HIGH. To make the Wi-Fi LED blink periodically, set pin 44 (WLED_N) to GPIO mode
and execute the following code:
import mraa
import time
# Refer to the pinout digram for the GPIO number to silk print mapping
# in this example the number 44 maps to Wi-Fi LED.
pin = mraa.Gpio(44)
pin.dir(mraa.DIR_OUT)
while True:
pin.write(1)
time.sleep(1)
pin.write(0)
time.sleep(1)
There's another GPIO mode which is INPUT. It takes the digital signal input from the pin
and interprets it into 1 and 0. This example will continuously print out the value received
P10
from
on the board. You can short
import
mraa
import
time
# Refer to the pinout digram for the GPIO number to silk print mapping
# in this example the number 2 maps to P10 on LinkIt Smart 7688 board
pin = mraa.Gpio(2)
pin.dir(mraa.DIR_IN)
while
True:
print
"P10
state:", pin.read()
time.sleep(0.3)
Finally, an interrupt service routine can be installed to the pin and invoked when the
values of the input pin P10 (GPIO2) has changed. Call
want to register and the function to be called. Note that the function runs in a different
thread.
import
mraa
import
time
def
callback(userdata):
print
"interrupt triggered with
pin = mraa.Gpio(2)
pin.dir(mraa.DIR_IN)
pin.isr(mraa.EDGE_BOTH, callback, None)
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
MediaTek LinkIt™ Smart 7688 Developer's Guide
to set the pin state to LOW or call
3V3
P10
and
userdata=", userdata
© 2015, 2016 MediaTek Inc.
pin.write(1)
to observe the change in values.
isr
API with the trigger type you
to set the pin
Page 61

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents