VWC


Output average analog read value for sensor calibration
//============================================
// Macro for data evaluation on PhotosynQ.org
// created: 19/07/2016
//============================================

//Define the output object here

// Fix for analog.read array


for (var i = 0; i < json.analog_read.length; i++) {
  json.analog_read[i] = parseFloat(json.analog_read[i]);
}


var output = {};

//Take the median of the analaog read
var analog_read = MathMEDIAN(json.analog_read);



output["analog_read"] = analog_read;


//Check if the key time exists in json
if (json.time !== undefined){

	//Add key time and value to output
	output["time"] = json.time;
}

//Return data
return output;
{
  "time_offset": 240,
  "time": 1471024627874,
  "device_version": "1",
  "device_id": "d4:f5:ff:ff:ff:ff",
  "device_battery": -300,
  "device_firmware": ".6",
  "firmware_version": ".6",
  "device_time": 1469700257,
  "sample": [
    {
      "time": 1471024627885,
      "protocol_id": 1,
      "analog_read": [
        "25456.000000",
        "25455.000000",
        "25456.000000",
        "25458.000000",
        "25458.000000",
        "25455.000000"
      ],
      "data_raw": [
        0,
        0,
        0,
        0,
        0,
        0
      ]
    }
  ],
  "app_os": "win",
  "app_name": "PhotosynQ",
  "app_version": "0.3.3",
  "app_device": "x86-32",
  "location": [
    "42.7227714",
    "-84.4745780"
  ]
}
Sam 0645   copy   copy  2
Created by

Dan TerAvest


Protocol connections:
1
Latest Update:
about 1 month ago