Anda di halaman 1dari 27

MediaTek LinkIt Smart 7688 Duo Get

Started Guide
Version: 0.92 Closed Beta
Release date: November 2015

Specifications are subject to change without notice.


2015 MediaTek Inc.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction of this information in whole or in part is strictly prohibited.
MediaTek LinkIt Smart 7688 Duo Get Started Guide

Document Revision History

Revision Date Description


0.92 Nov 2015 Closed beta release

2015, 2016 MediaTek Inc. Page 2 of 27


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 Duo Get Started Guide

Table of Contents

1. Get Started With the LinkIt Smart 7688 Development Platform ............................................. 5

1.1. Get the Hardware and Software .................................................................................................................. 5


1.2. Sign into the LinkIt Smart 7688 development boards Web UI ...................................................... 6
1.3. Update Your Boards Firmware .................................................................................................................. 10
1.4. Access the LinkIt Smart 7688 System Console through SSH ......................................................13
1.5. Run the Blink Example ................................................................................................................................... 15
The Wi-Fi LED on LinkIt Smart 7688 should start to blink every half second. ................................. 15
1.6. Connecting to the Internet........................................................................................................................... 16

2. Install Arduino IDE and Board Support Package.............................................................................. 19

Install the LinkIt Smart 7688 Duo COM port driver .......................................................................................22
Run a blink example on LinkIt Smart 7688 Duo in Python ........................................................................25

3. Whats Next? ................................................................................................................................................. 27

3.1. LinkIt Smart 7688 Developers Guide ...................................................................................................... 27


3.2. LinkIt Smart 7688 Tutorials ......................................................................................................................... 27
3.3. Seeed Studio Starter Tutorial ..................................................................................................................... 27
3.4. Hackster.io ........................................................................................................................................................... 27

2015, 2016 MediaTek Inc. Page 3 of 27


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 Duo Get Started Guide

Lists of tables and figures

Figure 1 Providing power to the LinkIt Smart 7688 board ....................................................................................... 7

Figure 2 Wi-Fi LED Status ....................................................................................................................................................... 7

Figure 3 Connecting to LinkIt_Smart_7688 AP ............................................................................................................8

Figure 4 LinkIt Smart 7688 in AP mode ............................................................................................................................ 9

Figure 5 LinkIt Smart 7688 Web UI Set Password ..................................................................................................... 10

Figure 6 LinkIt Smart 7688 firmware upgrade ............................................................................................................. 11

Figure 7 Selecting firmware file and start upgrade .................................................................................................. 12

Figure 8 Firmware version .................................................................................................................................................... 12

Figure 9 SSH access using Windows ............................................................................................................................... 13

Figure 10 PuTTY Security Warning ................................................................................................................................... 14

Figure 11 System console window..................................................................................................................................... 14

Figure 12 Change networking setting in Web UI ......................................................................................................... 16

Figure 13 Changing to Station mode in Web UI ............................................................................................................17

Figure 14 LinkIt Smart 7688 in Station Mode ............................................................................................................... 18

Figure 15 LinkIt Smart 7688 in Station mode connected to a Wi-Fi AP........................................................... 18

Figure 16 Board Manager URL ............................................................................................................................................ 20

Figure 17 Board Manager in Arduino IDE ....................................................................................................................... 20

Figure 18 Error downloading the LinkIt ONE SDK package ................................................................................... 21

Figure 19 Installing LinkIt Smart 7688 board package ............................................................................................ 21

Figure 20 LinkIt Smart 7688 board package installed ........................................................................................... 22

Figure 21 LinkIt Smart 7688 Board in Arduino IDE .................................................................................................... 22

Figure 22 Arduino Preference location ......................................................................................................................... 24

Figure 23 Driver installation security warning ........................................................................................................... 24

2015, 2016 MediaTek Inc. Page 4 of 27


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 Duo Get Started Guide

1. Get Started With the LinkIt Smart 7688 Duo


Development Platform

Welcome to the LinkIt Smart 7688 Duo development platform quick start guide, this guide is
based on using Windows with examples created in Python, however the same steps apply to Mac
and Linux and for node.js unless specifically noted otherwise.

1.1. Get the Hardware and Software

This section describes the hardware and software you need to get started. Before you start,
please make sure youve the following items ready:

A computer with Wi-Fi

An access point that is connected to the Internet. The AP should have either open access
(requires no password) or WPA/WPA2 encryption. APs that require Web-based
authentication are not supported

A micro-USB cable

Quick steps:
Buy a LinkIt Smart 7688 Duo development board

Install PuTTY for Microsoft Windows (For Windows


only)

Install Bonjour print service (For Windows 7 only) to


use local domain mylinkit.local

Next: Sign into the LinkIt Smart 7688 Duo development


boards Web UI.

Step-by-step

Step 1: Get Your LinkIt Smart 7688 Duo Development Board

Purchase the LinkIt Smart7688 Duo development board from a distributor such as Seeed Studio.

Step 2: Install PuTTY (For Windows only)

PuTTY provides you with the system console environment using Secure Socket Shell (SSH) access
to the development boards operating system.

2015, 2016 MediaTek Inc. Page 5 of 27


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 Duo Get Started Guide

Step 3: Install Bonjour Print Service (For Windows 7 only)

The LinkIt Smart 7688 Duo development board uses mylinkit.local as its local domain. In
Windows 7, youll need to install the Bonjour print service because mDNS is not supported. This
helps your computer discover the LinkIt Smart 7688 Duos IP address within the local domain. For
Windows 8 and later, Mac OS X and Linux, mDNS is supported and you can use mylinkit.local
without additional software.

If you are using a virtual machine, please note that mDNS may have problems reaching the guest OS
network. In this case, please use the host OS browser for the next step sign into the boards Web UI.

1.2. Sign into the LinkIt Smart 7688 Duo development boards Web
UI

Now power up your board, connect a USB power source or your PC to it and open the boards Web
UI, which youll use in subsequent steps to configure your board.

Quick steps:
Power up your board

Search for LinkIt_Smart_7688_XXXXXX AP and


connect the board through Wi-Fi

Sign into the LinkIt Smart 7688 Duo Web UI

Next: Update Your Boards Firmware.

Step-by-step

Step 1: Power up your board with a micro-USB cable

Plug in one end of a Micro USB cable to the power connector of the LinkIt Smart 7688 Duo and the
other end of the cable to a USB power source, such as your computer as shown in Figure 1, or a
USB power adaptor. Make sure you connect the cable to the Power (PWR) connector, not the USB
host (HOST) connector near the MPU reset button. The Power LED (Green) will light up solid first
followed by the Wi-Fi LED (Red) which will blink once per second. Then, after about 5 seconds, the
Wi-Fi LED will light on solid; this indicates that the boot loader has initialized.

2015, 2016 MediaTek Inc. Page 6 of 27


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 Duo Get Started Guide

Figure 1 Providing power to the LinkIt Smart 7688 Duo board

After boot loader initialization, the boot up process begins, which takes about 30 seconds. Next,
the Wi-Fi LED turns off; this means the system is ready to accept a Wi-Fi connection. Figure 2
shows how the Wi-Fi LED status matches the system state.

Wi-Fi LED Status and System State


AP Mode, w/o Client

System Boot loader Linux Wi-Fi


Power On Initializing Boot Strapping Ready AP Mode, w/ Client

3 blinks per sec, pauses 0.5


1 sec 4-5 secs ~30 secs secs
Blink Once Light Up Station Mode, Connecting

2 blinks per sec


Station Mode, Connected

Blinks as datas transmitting

Figure 2 Wi-Fi LED Status

Step 2: Connect your PC to the LinkIt_Smart_7688_XXXXXX AP


Open the Wi-Fi connection utility on your computer and connect to the access point named
LinkIt_Smart_7688_XXXXXX, as shown in Figure 3.

2015, 2016 MediaTek Inc. Page 7 of 27


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 Duo Get Started Guide

Figure 3 Connecting to LinkIt_Smart_7688 AP

The red LED will blink three times per second after youve connected to the
LinkIt_Smart_7688_XXXXXX AP.

If you have multiple LinkIt Smart 7688 Duo boards, power only one of them to prevent a name
collision. An alternative is to insert a micro SD card with a file that will change the name of the access
point after the board has booted up.

Keep in mind that once youve connected to LinkIt Smart 7688 Duo, your computer may no longer
have access to the internet its now joining the Local Area Network formed by LinkIt Smart 7688
Duo, as shown in Figure 4.

2015, 2016 MediaTek Inc. Page 8 of 27


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 Duo Get Started Guide

Figure 4 LinkIt Smart 7688 in AP mode

Youll learn how to connect LinkIt Smart 7688 Duo to the Internet in later steps. But first, you
need to configure the board.

Step 3: Access the LinkIt Smart 7688 Duo Web UI configuration tools

You now setup the LinkIt Smart 7688 Duo Web UI, a tool for configuring the settings of you board.

1) In your web browser open http://mylinkit.local, as shown Figure 5.

2015, 2016 MediaTek Inc. Page 9 of 27


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 Duo Get Started Guide

Figure 5 LinkIt Smart 7688 Duo Web UI Set Password

2) Set a password using at least 6 alphanumeric characters and click Submit. Enter the
password again and click Sign In.

If the board already has a password and you dont remember it, use a USB drive to upgrade the
firmware or press and hold the Wi-Fi button for at least 20 seconds and release to return the board to
the factory defaults. Keep in mind if you use either of these methods, it will restore to boards default
settings and all user data will be removed from the device. For more information on how to upgrade
firmware using a USB drive or use the buttons please refer to LinkIt Smart 7688 Developers Guide.

1.3. Update Your Boards Firmware

The MediaTek Labs website has the latest firmware for your LinkIt Smart 7688 Duo development
board. It is recommended that you upgrade the firmware of your new board to ensure you have
the latest version. This section describes how.

2015, 2016 MediaTek Inc. Page 10 of 27


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 Duo Get Started Guide

Quick steps:
Install LinkIt Smart 7688 SDT

Upgrade LinkIt Smart 7688 Duo firmware using Web


UI

Next: Access the LinkIt Smart 7688 Duo System Console


through SSH.

Step-by-step

Step 1: Install LinkIt Smart 7688 SDT

1) The latest LinkIt Smart 7688 SDT from the MediaTek Labs website includes the firmware,
bootloader, and toolchain you need to develop applications for LinkIt Smart 7688 Duo.
Download and unzip the SDK into a permanent location on your computer, such as
D:\{SDK package}.
2) Note the location of the firmware file lks7688.img, for example:
D:\{SDK package}\lks7688.img

Step 2: Run the LinkIt Smart 7688 Duo Firmware Updater Application

3) In the Web UI home page, click Upgrade Firmware, as shown Figure 6:

Figure 6 LinkIt Smart 7688 Duo firmware upgrade

4) Click Choose the file and select the lks7688.img file then click Upgrade & Restart as
shown Figure 7.

2015, 2016 MediaTek Inc. Page 11 of 27


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 Duo Get Started Guide

Figure 7 Selecting firmware file and start upgrade

5) The firmware uploads to your board. Please make sure the board stays connected to its
power source until the firmware upgrade is completed. Notice the Wi-Fi LED blinks for
about 3 minutes (firmware upgrading), then the board will restart and the LED lights on for
about 30 seconds (rebooting). Finally, the board enters AP mode and is ready to be
connected.
6) Find the LinkIt_Smart_7688_XXXXXX AP and connect the board through Wi-Fi. Notice the
Wi-Fi LED blinks 3 times per second after the board is connected to a client device. Now,
reload the mylinkit.local webpage, set a new password and sign in. The new firmware
version details will be displayed under Software Information, as shown Figure 8.

Figure 8 Firmware version

You now have the latest firmware on your LinkIt Smart 7688 development board.

Next: Access the LinkIt Smart 7688 Duo system console using SSH.

2015, 2016 MediaTek Inc. Page 12 of 27


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 Duo Get Started Guide

1.4. Access the LinkIt Smart 7688 Duo System Console through
SSH

LinkIt Smart 7688 Duo system console enables you to enter text commands and get system
administration messages.

Quick steps:
Open your terminal emulator and sign in

Next: Run the Blink Example.

Step 1: Open a Terminal Emulator and Sign in.

On Windows:

1) Open PuTTY and in the configuration window, type mylinkit.local in Host Name, click
the SSH radio button and then Open, as shown Figure 9.

Figure 9 SSH access using Windows

2015, 2016 MediaTek Inc. Page 13 of 27


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 Duo Get Started Guide

2) A Security Alert window will pop up as shown below, this happens when you use PuTTY for
the first time, or after upgrading firmware or bootloader, or use a different board. Click Yes.

Figure 10 PuTTY Security Warning

3) The PuTTY terminal window displays. Log in with username root and the password you set
previously in the Web UI, after log in you should see a screen similar to Figure 11.

Figure 11 System console window

2015, 2016 MediaTek Inc. Page 14 of 27


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 Duo Get Started Guide

On Mac or Linux:

Open Terminal and at the command prompt type ssh root@mylinkit.local. Press return and
enter the password you set previously in the Web UI.

If you see a warning error indicating host ID has changed, please check the Troubleshooting
section in the MediaTek LinkIt Smart 7688 Developers Guide.

You now have access to system console using SSH.

1.5. Run the Blink Example

You are now ready to run your first example on the LinkIt Smart 7688 development board. This
example switches the boards Wi-Fi LED on and off every half second.

Quick steps:
Execute the example in system console

Watch the LED blink on the board

Terminate the example

Next: Connecting to the Internet.

Step-by-step

Step 1: Run the blink example in LinkIt Smart 7688 Duo system console

In the system console, type following command to run the blink example in Python:

# python /IoT/examples/blink-gpio44.py

Step 2: Watch the Wi-Fi LED blink

The Wi-Fi LED on LinkIt Smart 7688 Duo should start to blink every half second.

Step 3: Terminate the blink example

In the system console, type CTRL + C, this will terminate the example.

You can now explore the system console and try other examples or Linux command utilities but
before that, its important to connect the board to the Internet first. You can do that by

2015, 2016 MediaTek Inc. Page 15 of 27


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 Duo Get Started Guide

connecting the board to a Wi-Fi Access Point that has Internet connection. The steps are
described in the next section.

1.6. Connecting to the Internet

In order for the board to access the Internet, it needs to join another network that has an access
point connected to the Internet, and to do that, the board needs to be in Station mode.

Quick steps:
Connect LinkIt Smart 7688 Duo to a Wi-Fi Access Point for Internet Access

Connect the Host Computer to an AP that is in a Wi-Fi network

Check for Internet connection

Next: Install Arduino IDE and Board Support Package

Step-by-step

Step 1: Connecting LinkIt Smart 7688 Duo to a Wi-Fi Access Point for Internet Access

1) Open a browser with URL mylinkit.local,and sign-in to the Web UI with the password
you have set. Click Network on upper right as shown Figure 12.

Figure 12 Change networking setting in Web UI

2015, 2016 MediaTek Inc. Page 16 of 27


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 Duo Get Started Guide

2) Select the Station mode and click Refresh or downward arrow on the right to find the AP
to connect to. After youve selected the AP, enter password if required. Click Configure &
Restart to finish as shown below.

Note: If you entered the APs password incorrectly, you can reset the board to AP mode by clicking the
Wi-Fi button for at least 5 seconds and release, this allows you to redo Station mode in the network
settings again.

Figure 13 Changing to Station mode in Web UI

After youve switched to Station mode, the Wi-Fi LED should blink once a second, this
indicates LinkIt Smart 7688 Duo is in Station mode.
Since the Wi-Fi mode has changed, your host computer is now disconnected from LinkIt
Smart 7688 Duo. If you try to reload the web UI, youll see that it is not available anymore.
To establish connection again, follow the next step.

Step2: Connect the host computer to the same AP

Open the Wi-Fi connection utility on your computer and connect to the same access point
as in Step 1. You computer is now under the same local area network formed the by the
Wi-Fi Access Point you connected to, as shown Figure 14.

2015, 2016 MediaTek Inc. Page 17 of 27


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 Duo Get Started Guide

Figure 14 LinkIt Smart 7688 Duo in Station Mode

Step3: Open terminal emulator and Sign in again

Once your host computer has joined the same Wi-Fi network, you can again connect to
LinkIt Smart 7688 Duo with mylinkit.local domain again through SSH as before.

Step 4: Check for Internet connection

Now check if youve established Internet connection by typing the following command in
the terminal window:

# ping c 5 www.mediatek.com

If you see a screen that is similar to Figure 15, then youve connected to the Wi-Fi
networks AP. The Wi-Fi LED will blink once every second indicating Station mode. If the
ping utility reports errors such as unreachable destination, check the setting of your
Wireless AP.

Figure 15 LinkIt Smart 7688 Duo in Station mode connected to a Wi-Fi AP

Next: Install Arduino IDE and Board Support Package

2015, 2016 MediaTek Inc. Page 18 of 27


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 Duo Get Started Guide

2. Install Arduino IDE and Board Support Package

LinkIt Smart 7688 Duo supports Arduino IDE and board support package. This section describes
how to install the software.

Quick steps:
Install Arduino IDE 1.6.5

Install board support package

Next: Install the COM port driver.

Step-by-step

Step 1: Install Arduino IDE

The Arduino IDE provides your coding environment and is used for monitoring the development
board. LinkIt Smart 7688 Duo supports Arduino IDE version 1.6.5.

Step 2: Install board support package

In order for Arduino IDE to recognize LinkIt Smart 7688 Duo development board, installing board
support package is necessary.

1) To install LinkIt Smart 7688 Duo board support package, open Arduino IDE, click File >
Preferences and insert the following URL to the Additional Boards Manager URL field as
shown in Figure 16.
http://download.labs.mediatek.com/package_mtk_linkit_smart_7688_test_in
dex.json

2015, 2016 MediaTek Inc. Page 19 of 27


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 Duo Get Started Guide

Figure 16 Board Manager URL

2) Make sure your computer is connected to the Internet.


3) In the Arduino Tools menu point to Board then click Boards Manager as shown in Figure 17.

Figure 17 Board Manager in Arduino IDE

LinkIt Smart 7688 board support package starts downloading automatically and it may
take several seconds for the Boards Manager to download the repository.

2015, 2016 MediaTek Inc. Page 20 of 27


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 Duo Get Started Guide

If there is a downloading error (per Figure 18), remove the cached .json file. The location of the
cached .json file is the same as the location of the preferences.txt file. It can be found in the
Arduino IDE under the File menu by clicking Preferences.

Figure 18 Error downloading the LinkIt ONE SDK package

4) There should now be a LinkIt Smart 7688 item appearing in the boards list on the Boards
Manager as shown Figure 19. Select the LinkIt Smart 7688 version and click Install.

Figure 19 Installing LinkIt Smart 7688 board package

5) The installation completes, as shown in Figure 20.

2015, 2016 MediaTek Inc. Page 21 of 27


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 Duo Get Started Guide

Figure 20 LinkIt Smart 7688 board package installed

6) You now have the LinkIt Smart 7688 installed on Arduino IDE as shown in Figure 21.

Figure 21 LinkIt Smart 7688 Board in Arduino IDE

Next: Install LinkIt Smart 7688 Duo COM port driver

Install the LinkIt Smart 7688 Duo COM port driver

After youve installed the board package, follow the below step to install COM port driver for
LinkIt Smart 7688 Duo.
2015, 2016 MediaTek Inc. Page 22 of 27
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 Duo Get Started Guide

Quick steps:
Connect LinkIt Smart 7688 Duo to a computer

Check the USB serial COM port in device manager

Install drivers

Next: Create and run an example.

Step-by-step

Step 1: Connect LinkIt Smart 7688 Duo development board to a computer

Plug in one end of the micro USB cable to the Power/MCU connector of the LinkIt Smart 7688 Duo
and the other end of the cable to a computer.

Step 2: Check the USB serial COM port in device manager

Open the device manager and check for a USB serial COM port with the following port ID:

Bootloader COM port: VID=0x0E8D, PID=0xAB00

Arduino Sketch COM port: VID=0x0E8D, PID=0xAB01

Step 3: Install drivers

Youll need to install drivers depending on your operating system.

For Windows, install a Serial COM port INF driver from here or the following link:

{ARDUINO_IDE_PREFERENCE_LOCATION}/packages/LinkIt/hardware/avr/0.1.3/driver
/linkit_smart_7688.inf

You can find the Arduino preference location at File > Preferences, see the
preference.txt path, as shown in Figure 22.

2015, 2016 MediaTek Inc. Page 23 of 27


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 Duo Get Started Guide

Figure 22 Arduino Preference location

Right click on the linkit_smart_7688.inf and select install. A security windows will open,
as shown in Figure 23, click Install this driver software anyway. This completes the driver
installation.

Figure 23 Driver installation security warning

For Linux, it should work without having to install a driver. LinkIt Smart 7688 should be
in /dev folder and mounted as ttyUSB0.

For OS X, its also not required to install a driver, LinkIt Smart 7688 Duo is mounted as a
serial device under/dev/tty.usbmodem1413. The number 1413 may be different on each
OS X machine.

Next: Run a blink example in Python

2015, 2016 MediaTek Inc. Page 24 of 27


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 Duo Get Started Guide

Run a blink example on LinkIt Smart 7688 Duo in Python

This example uploads an Arduino sketch to LinkIt Smart 7688 Duo and listens for commands in
Serial1 port of the sketch. The commands are issued from the Linux side using a Python
program. Once the Serial1 port receives a command from the Python program, it will change the
status of the D13 LED on the board.

Quick steps:
Upload an Arduino sketch to LinkIt Smart 7688 Duo

Create a Python program and run it

Watch the D13 LED blink

Next: Whats next?

Step-by-step

Step 1: Upload an Arduino sketch to LinkIt Smart 7688 Duo

1) Open Arduino IDE and click File > New, copy and paste the following example code.
Upload the sketch when youre done.

void setup() {
Serial.begin(115200); // open serial connection to USB Serial port
(connected to your computer)
Serial1.begin(57600); // open internal serial connection to MT7688
// in MT7688, this maps to device
pinMode(13, OUTPUT);
}
void loop() {
int c = Serial1.read(); // read from MT7688
if (c != -1) {

switch(c) {
case '0': // turn off D13 when
receiving "0"
digitalWrite(13, 0);
break;
case '1': // turn on D13 when
receiving "1"
digitalWrite(13, 1);
break;
}
}
}

2015, 2016 MediaTek Inc. Page 25 of 27


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 Duo Get Started Guide

You wont see the LED blink at this point yet because its waiting for commands on Serial1 from a
program, which youll create next.

Step 2: Create a Python program to send commands to the sketch

This program sends the 0 and 1 commands to the ttys0 device periodically. The commands maps
to the Serial1 in the Arduino sketch.

2) Create a file blink_on_duo.py in the system console by typing below command. After the
text editor opens, press the i key and go to next step.

# vim blink_on_duo.py

3) Copy the below example to the editor of blink_on_duo.py.

import serial
import time

s = None

def setup():
global s
# open serial COM port to /dev/ttyS0, which maps to UART0(D0/D1)
# the baudrate is set to 57600 and should be the same as the one
# specified in the Arduino sketch uploaded to ATMega32U4.
s = serial.Serial("/dev/ttyS0", 57600)
def loop():
# send "1" to the Arduino sketch on ATMega32U4.
# the sketch will turn on the LED attached to D13 on the board
s.write("1")
time.sleep(1)
# send "0" to the sketch to turn off the LED
s.write("0")
time.sleep(1)
if __name__ == '__main__':
setup()
while True:
loop()

4) Save the file and exit the editor by typing :wq!


5) Run the Python program by typing the below command in the system console.

# python ./blink_on_duo.py

Step 3: Watch the D13 LED on LinkIt Smart 7688 Duo blink

After youve executed the Python program and see the D13 LED on LinkIt Smart 7688 Duo blink
every second, youve successfully completed the example.

Next: Whats next?

2015, 2016 MediaTek Inc. Page 26 of 27


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 Duo Get Started Guide

3. Whats Next?

Youve set up the development environment for LinkIt Smart 7688 Duo and ran examples using
Python. Please check out more tutorials, resources and inspiration related to LinkIt Smart 7688
Duo from the following links:

3.1. LinkIt Smart 7688 Developers Guide


This document provides you with detailed information on the LinkIt Smart 7688 development
board, SDK tools, introduction to OpenWrt and programming guide

3.2. LinkIt Smart 7688 Tutorials


The following tutorials are available:

o LinkIt Smart 7688 & MediaTek Cloud Sandbox Python

o LinkIt Smart 7688 & MediaTek Cloud Sandbox Node.js

3.3. Seeed Studio Starter Tutorial


Create projects using LinkIt Smart 7688 applications for your LinkIt Smart 7688 HDK and see other
Get Started Guide in Node.js

3.4. Hackster.io
See what other developers have created with LinkIt Smart 7688 and get inspired

2015, 2016 MediaTek Inc. Page 27 of 27


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.

Anda mungkin juga menyukai