{
  "_exportDate": "2021-10-27T19:59:10.522Z",
  "_type": "flow",
  "applicationId": "616f38d6ab0eb2b28e565e2a",
  "customNodeVersions": [
  ],
  "customNodes": [
  ],
  "description": "",
  "enabled": true,
  "flowClass": "embedded",
  "globals": [
  ],
  "id": "616f3926ab0eb2b28e565e2e",
  "minimumAgentVersion": "0.0.0",
  "name": "Read Accelerometer",
  "nodes": [
    {
      "config": {
        "functionName": "read_accelerometer",
        "inputs": [
        ],
        "outputs": [
          {
            "destinationPath": "working.accelArr",
            "maxLength": "1024",
            "type": "[f32]"
          },
          {
            "destinationPath": "working.sampleRate",
            "type": "f32"
          }
        ],
        "resultPath": ""
      },
      "id": "p69vJQLvL1",
      "meta": {
        "category": "data",
        "description": "",
        "label": "Registered Function",
        "name": "registered-function",
        "x": 20,
        "y": 120
      },
      "outputIds": [
        [
          "eaQ8ysZAqC"
        ]
      ],
      "type": "RegisteredFunctionNode"
    },
    {
      "config": {
        "message": "",
        "property": ""
      },
      "id": "IKQB67NHlv",
      "meta": {
        "category": "output",
        "description": "",
        "label": "Debug",
        "name": "debug",
        "x": 20,
        "y": 1020
      },
      "outputIds": [
      ],
      "type": "DebugNode"
    },
    {
      "config": {
        "resultPath": "working.fftResults",
        "sourcePath": "working.accelArr"
      },
      "id": "eaQ8ysZAqC",
      "meta": {
        "category": "logic",
        "description": "",
        "label": "Fast Fourier Transform",
        "name": "fft",
        "x": 20,
        "y": 220
      },
      "outputIds": [
        [
          "agup2Z1_kW"
        ]
      ],
      "type": "FftNode"
    },
    {
      "config": {
        "rules": [
          {
            "destination": "working.fftResults.[0]",
            "type": "set",
            "valueTemplate": "{{working.fftResults.[0]}} === 0",
            "valueTemplateType": "string"
          }
        ]
      },
      "id": "agup2Z1_kW",
      "meta": {
        "category": "logic",
        "description": "",
        "label": "Mutate",
        "name": "mutate",
        "x": 20,
        "y": 320
      },
      "outputIds": [
        [
          "jUlG1l3msG"
        ]
      ],
      "type": "MutateNode"
    },
    {
      "config": {
        "resultPath": "working.rmsResult",
        "sourcePath": "working.accelArr"
      },
      "id": "jUlG1l3msG",
      "meta": {
        "category": "logic",
        "description": "",
        "label": "Root Mean Square",
        "name": "rms",
        "x": 20,
        "y": 420
      },
      "outputIds": [
        [
          "JolGXagRBg"
        ]
      ],
      "type": "RmsNode"
    },
    {
      "config": {
        "destination": "working.accelArrEncoded",
        "source": "working.accelArr"
      },
      "id": "JolGXagRBg",
      "meta": {
        "category": "logic",
        "description": "",
        "label": "JSON: Encode",
        "name": "json-encode",
        "x": 20,
        "y": 520
      },
      "outputIds": [
        [
          "SEzgdVfgYT"
        ]
      ],
      "type": "JsonEncodeNode"
    },
    {
      "config": {
        "functionName": "base64_encode",
        "inputs": [
          {
            "type": "str",
            "valueTemplate": "{{working.accelArrEncoded}}"
          }
        ],
        "outputs": [
        ],
        "resultPath": "working.accelArrBlob"
      },
      "id": "SEzgdVfgYT",
      "meta": {
        "category": "data",
        "description": "",
        "label": "Registered Function",
        "name": "registered-function",
        "x": 20,
        "y": 620
      },
      "outputIds": [
        [
          "qORN0plu4x"
        ]
      ],
      "type": "RegisteredFunctionNode"
    },
    {
      "config": {
        "destination": "working.fftResultsEncoded",
        "source": "working.fftResults"
      },
      "id": "qORN0plu4x",
      "meta": {
        "category": "logic",
        "description": "",
        "label": "JSON: Encode",
        "name": "json-encode",
        "x": 20,
        "y": 720
      },
      "outputIds": [
        [
          "kEAhOYs2Gl"
        ]
      ],
      "type": "JsonEncodeNode"
    },
    {
      "config": {
        "attrDataMethod": "individualFields",
        "attrInfos": [
          {
            "key": "sample-rate",
            "valueTemplate": "{{working.sampleRate}}"
          },
          {
            "key": "rms",
            "valueTemplate": "{{working.rmsResult}}"
          },
          {
            "key": "accel-data",
            "valueTemplate": "{{working.accelArrBlob}}"
          },
          {
            "key": "fft-data",
            "valueTemplate": "{{working.fftBlob}}"
          }
        ],
        "resultPath": "",
        "timeSourceType": "payloadTime"
      },
      "id": "xxycTFH2qj",
      "meta": {
        "category": "output",
        "description": "",
        "label": "Device: State",
        "name": "device-state",
        "x": 20,
        "y": 920
      },
      "outputIds": [
        [
          "IKQB67NHlv"
        ]
      ],
      "type": "DeviceChangeStateNode"
    },
    {
      "config": {
        "functionName": "base64_encode",
        "inputs": [
          {
            "type": "str",
            "valueTemplate": "{{working.accelArrEncoded}}"
          }
        ],
        "outputs": [
        ],
        "resultPath": "working.accelArrBlob"
      },
      "id": "kEAhOYs2Gl",
      "meta": {
        "category": "data",
        "description": "",
        "label": "Registered Function",
        "name": "registered-function",
        "x": 20,
        "y": 820
      },
      "outputIds": [
        [
          "xxycTFH2qj"
        ]
      ],
      "type": "RegisteredFunctionNode"
    }
  ],
  "triggers": [
    {
      "config": {
        "seconds": 10
      },
      "key": "bCS8qgHjAJoiRuzXhJ8kZ",
      "meta": {
        "category": "trigger",
        "description": "",
        "label": "Timer",
        "name": "timer",
        "timerTypeSelect": "seconds",
        "uiId": "RBH5h2hAHD",
        "x": 20,
        "y": 20
      },
      "outputIds": [
        [
          "p69vJQLvL1"
        ]
      ],
      "type": "timer"
    }
  ]
}