MediaTek LinkIt™ Smart 7688 Developer's Guide
© 2015, 2016 MediaTek Inc.
Page 64
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.
2)
In the
root@myLinkIt:~/app#
prompt, create a file named blink.py by entering the
following command.
vim blink.py
3)
Press
i
to insert the below codes in the editor. For example:
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
led
=
mraa.Gpio(
44
)
led.dir(mraa.DIR_OUT)
# set direction to output
while
True
:
led.write(
1
)
# turn on LED
time.sleep(
1
)
led.write(
0
)
# turn off LED
time.sleep(
1
)
4)
Press
:wq!
to save the
blink.py
file.
5)
Now you’re ready to run this Python application. In the app directory, type following
command to run the app:
python ./blink.py
The W-Fi LED on LinkIt Smart 7688 should blink every second.
Press
<Ctrl> C
to terminate the Python program.
5.1.5.
LED blink example using mraa in LinkIt Smart 7688 GPIO in Node.js
This example shows you how to use mraa library in Node.js to make the Wi-Fi LED on LinkIt Smart
7688 blink.
6)
Connect to LinkIt Smart 7688 console using SSH. In the system console, create a directory
called
app
and then switch into the directory. For example:
mkdir app
cd app
7)
Use
NPM
to initialize your file. NPM is a package manager for Node.js and is pre-installed
in LinkIt Smart 7688. You can install it from
just in case.