How to Get Voltage with a Grove Voltage Divider in Wio Node

REST API

1) Connect the module to PORT1.

2) Run the following code:

import requests

res = requests.get('https://host/v1/node/GroveVolDividerA0/voltage_x3', headers = { 'Authorization': 'nodetoken' }) # or voltage_x10

if res.ok:
  print res.text

CLI

1) Connect the module to PORT1.

2) Configure the CLI:

wio login

3) Run the following command:

wio call nodetoken GET /v1/node/GroveVolDividerA0/voltage_x3 # or voltage_x10
Advertisements

How to Measure Distance with a Grove Ultrasonic Ranger in Wio Node

REST API

1) Connect the module to PORT0.

2) Run the following code:

import requests

res = requests.get('https://host/v1/node/GroveUltraRangerD0/range_in_cm', headers = { 'Authorization': 'nodetoken' }) # or range_in_inch

if res.ok:
  print res.text

CLI

1) Connect the module to PORT0.

2) Configure the CLI:

wio login

3) Run the following command:

wio call nodetoken GET /v1/node/GroveUltraRangerD0/range_in_cm 

How to Detect Touch on a Grove Touch Sensor in Wio Node

REST API

1) Connect the module to PORT0.

2) Run the following code:

import requests

res = requests.get('https://host/v1/node/GenericDInD0/input', headers = { 'Authorization': 'nodetoken' })

if res.ok:
  print res.text

WebSocket API

1) Connect the module to PORT0.

2) Run the following code:

import json
import websocket

def on_open(ws):
  ws.send("nodetoken")

def on_message(ws, msg):
  msg_json = json.loads(msg)

  if msg_json['msg']['input_changed']:
    print msg

ws = websocket.WebSocketApp("wss://host/v1/node/event", on_open = on_open, on_message = on_message)

ws.run_forever()

CLI

1) Connect the module to PORT0.

2) Configure the CLI:

wio login

3) Run the following command:

wio call nodetoken GET /v1/node/GenericDInD0/input

How to Get Temperature from a Grove Temperature Sensor in Wio Node

REST API

1) Connect the module to PORT1.

2) Run the following code:

import requests

res = requests.get('https://host/v1/node/GroveTempA0/temp', headers = { 'Authorization': 'nodetoken' })

if res.ok:
  print res.text

CLI

1) Connect the module to PORT1.

2) Configure the CLI:

wio login

3) Run the following command:

wio call nodetoken GET /v1/node/GroveTempA0/temp

How to Get Humidity from a Grove Temperature & Humidity Sensor in Wio Node

REST API

1) Connect the module to PORT0.

2) Run the following code:

import requests

res = requests.get('https://host/v1/node/GroveTempHumD0/humidity', headers = { 'Authorization': 'nodetoken' })

if res.ok:
  print res.text

CLI

1) Connect the module to PORT0.

2) Configure the CLI:

wio login

3) Run the following command:

wio call nodetoken GET /v1/node/GroveTempHumD0/humidity

How to Get Temperature from a Grove Temperature & Humidity Sensor in Wio Node

REST API

1) Connect the module to PORT0.

2) Run the following code:

import requests

res = requests.get('https://host/v1/node/GroveTempHumD0/temperature', headers = { 'Authorization': 'nodetoken' }) # or temperature_f for fahrenheit

if res.ok:
  print res.text

CLI

1) Connect the module to PORT0.

2) Configure the CLI:

wio login

3) Run the following command:

wio call nodetoken GET /v1/node/GroveTempHumD0/temperature # or temperate_f for fahreinheit

How to Get Sound Intensity from a Grove Sound Sensor in Wio Node

REST API

1) Connect the module to PORT1.

2) Run the following code:

import requests

res = requests.get('https://host/v1/node/GroveSoundA0/sound_level', headers = { 'Authorization': 'nodetoken' })

if res.ok:
  print res.text

CLI

1) Connect the module to PORT1.

2) Configure the CLI:

wio login

3) Run the following command:

wio call nodetoken GET /v1/node/GroveSoundA0/sound_level

How to Get Rotary Angle from a Grove Rotary Angle Sensor in Wio Node

REST API

1) Connect the module to PORT1.

2) Run the following code:

import requests

res = requests.get('https://host/v1/node/GroveRotaryAngleA0/angle', headers = { 'Authorization': 'nodetoken' })

if res.ok:
  print res.text

CLI

1) Connect the module to PORT1.

2) Configure the CLI:

wio login

3) Run the following command:

wio call nodetoken GET /v1/node/GroveRotaryAngleA0/angle

How to Open/Close a Grove Relay in Wio Node

REST API

1) Connect the module to PORT0.

2) Run the following code:

import requests

res = requests.post('https://host/v1/node/GroveRelayD0/onoff/0', headers = { 'Authorization': 'nodetoken' })

if res.ok:
  print res.text

CLI

1) Connect the module to PORT0.

2) Configure the CLI:

wio login

3) Run the following command:

wio call nodetoken POST /v1/node/GroveRelayD0/onoff/1 # or 0

How to Get Light Intensity with a Grove Light Sensor in Wio Node

REST API

1) Connect the module to PORT1.

2) Run the following code:

import requests

res = requests.get('https://host/v1/node/GenericAInA0/analog', headers = { 'Authorization': 'nodetoken' })

if res.ok:
  print res.text

CLI

1) Connect the module to PORT1.

2) Configure the CLI:

wio login

3) Run the following command:

wio call nodetoken GET /v1/node/GenericAInA0/analog