MediaTek LinkIt™ Smart 7688 Developer's Guide
© 2015, 2016 MediaTek Inc.
Page 65
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.
npm init
After about 10 seconds, you’ll be prompted to enter several inputs such as a name for app, version
and description etc. as shown in Figure 43. This is a set up process for the node application. For
this tutorial, press enter for all questions.
Figure 43 Set up the Node.js application prompt
8)
In the
root@myLinkIt:~/app#
prompt, create a file named app.js by entering the
following command.
vim app.js
9)
Press
i
to insert the below codes in the editor. For example:
var m = require('mraa');
var ledState = true;
var myLed = new m.Gpio(44); // GPIO44 is the Wi-Fi LED
myLed.dir(m.DIR_OUT);
function periodicActivity() {
myLed.write(ledState ? 1 : 0);
ledState = !ledState;
setTimeout(periodicActivity, 1000);
}
periodicActivity();
10)
Press
:wq!
to save the
app.js
file.