Coding Guide

Basic steps

1. Add e-skin name space
using ESkin and ESkin.Unity
2. Initialization
UnityESkinSensor sensor;
sensor = new UnityESkinSensor();
3. Set a pairing device
sensor.PairingDevice = “[Your COM port]”;
4. Start service
sensor.Start();
5. Get values from e-skin
int elbowR = sensor.GetStrainValue(StrainSensorChannel.ELBOW_R);
API Reference: Strain Sensor Channels IMU Sensor Channels
6. Write your program
7. Termination
sensor.OnDestroy();

This is a very simple example code for Unity C# script.

using UnityEngine;
using System.Collections;

// e-skin name space.
using ESkin;
using ESkin.Unity;

public class ESkinSensorReceiver : MonoBehaviour {

    UnityESkinSensor sensor;

    // Use this for initialization
    void Start () {

        // Instaintiate.
        sensor = new UnityESkinSensor();

        // Choose the pairing device (COM port that is connected your e-skin hub).
        sensor.PairingDevice = "COM04"; 

        try {
            // Connection start.
            sensor.Start();
        } catch {
            // That return an exeption if can not connect your e-skin hub.
            Debug.LogError("Failed to connect");
        }
    }

    // Update is called once per frame
    void Update () {

        if (sensor.IsConnected) {

            // Get the strain sensor value on you right elbow.
            int elbowR = sensor.GetStrainValue(StrainSensorChannel.ELBOW_R);

            // If you want smoothed value, please use "GetFilteredStrainValue" method.
            int filteredShoulderL = sensor.GetFilteredStrainValue(StrainSensorChannel.SHOULDER_L);

            // Second argument is number of frame on past received. Zero means the current. One means one frame before.
            int fiveFramePastAxillaR = sensor.GetStrainValue(StrainSensorChannel.AXILLA_R, 5);

            // Get IMU sensor (Accelerometer and Gyoroscope) values.
            int accelX = sensor.GetIMUValue(IMUSensorChannel.ACCEL_X);

            // Let's make your app!! (^o^)/
        }
    }

    void OnDestroy() {
        sensor.OnDestroy();
    }
}

For e-skin Class/Property/Function, please refer to the API Reference.