The labs in this repository show how to build applications on ARTIK modules using the node.js artik-sdk.
The following are required in order to run the labs.
- ARTIK Module (530 or 710)
- ARTIK SDK
- npm -
sudo dnf install npm
- git -
sudo dnf install git
Note: The commands can be run either within a ssh session or in a serial connection.
- Clone this git repository in your module -
git clone https://github.com/SamsungARTIK/artik-sdk-lab.git
- Change directory
cd artik-sdk-lab
- Run
npm install
to install the node dependencies specified inpackage.json
of the repository.
-
Follow these instructions to sign up and create an account on ARTIK Cloud, if you haven't already created one on artik.io.
-
Create devices of type:
- ARTIK Cloud Light - com.demo.artik.light
- ARTIK Cloud Switch - com.demo.artik.button
- ARTIK Cloud Temperature Monitor - com.demo.artik.tempmonitor
- For each device, generate a device token:
- Make a note of the device ID and device token for each device you registered.
- Fill the
ID
s andTOKEN
s in the .env file with your own device IDs and device Tokens:
LED_DEVICE_ID=
LED_DEVICE_TOKEN=
SWITCH_DEVICE_ID=
SWITCH_DEVICE_TOKEN=
TEMP_SENSOR_DEVICE_ID=
TEMP_SENSOR_DEVICE_TOKEN=
- Save the file.
In this lab, a configured LED will be toggled on/off every 2 seconds. This lab exercises the artik-sdk's GPIO API, specifically when configured in output mode.
Run npm run light
In this lab, a configured Switch will be used to toggle on/off a LED. This lab exercises the artik-sdk's GPIO API, in both input and output modes.
Run npm run switch
In this lab, a configured Switch will be connected to ARTIK Cloud. This lab exercises the artik-sdk's ARTIK Cloud connectivity, specifically using the Cloud HTTP/REST APIs.
Run npm run cloudSwitch
In this lab, a configured LED will be controlled using ARTIK Cloud. This lab exercises the artik-sdk's ARTIK Cloud connectivity, specifically using the Cloud WebSocket APIs.
Run npm run cloudLight
In this lab, a temperature sensor will be connected to ARTIK Cloud. This lab exercises the artik-sdk's Sensors API and the artik-sdk's ARTIK Cloud connectivity, specifically using the Cloud HTTP/REST APIs.
Run npm run cloudTempMonitor
If you are not familiar with ARTIK Cloud, we have extensive documentation at https://developer.artik.cloud/documentation
The full ARTIK Cloud API specification can be found at https://developer.artik.cloud/documentation/api-reference/
Peek into advanced sample applications at https://developer.artik.cloud/documentation/samples/
To create and manage your services and devices on ARTIK Cloud, visit the Developer Dashboard at https://developer.artik.cloud
Licensed under the Apache License. See LICENSE.
Copyright (c) 2017 Samsung Electronics Co., Ltd.