Samuel Lopez
Published © GPL3+

Smart Temperature to Prevent Heat Illness

A smart city dispositive for alerts about the heat level.

BeginnerFull instructions provided3 hours599

Things used in this project

Hardware components

Rapid IoT Prototyping Kit
NXP Rapid IoT Prototyping Kit
×1

Story

Read more

Schematics

sln-rpk-node-qsg_L2RYdHahkk.pdf

Code

Program

C/C++
{
  "name": "Heat illness",
  "createVersion": "2017-08-12",
  "description": "Demonstrates reading of weather related sensors such as temperature, humidity, pressure, ambient light, and air quality. Demonstrates basic BLE Characteristic writing and reading as well as cloud storage.",
  "lastModified": "2018-02-13T00:39:19.386Z",
  "created": "2018-02-13T00:39:19.386Z",
  "meta": {
    "projectTypeName": "NXP Rapid IoT",
    "projectTypeId": "NxpRpk"
  },
  "planes": {
    "NXP Rapid IoT": {
      "type": "mcuxpresso",
      "compilerVersion": "latest",
      "variants": [
        "NxpRpk"
      ],
      "meta": {},
      "elements": [
        {
          "name": "TemperatureCharacteristic",
          "type": "EmbeddedBLECharacteristicCustom",
          "variants": [
            "embedded",
            "triggers",
            "abilities",
            "properties",
            "variables",
            "ble"
          ],
          "properties": {
            "errorData": {},
            "code": {
              "trigger": "\treturn ATMO_Status_Success;",
              "setup": "\n\tATMO_BLE_GATTSAddService(\n\t\tATMO_PROPERTY(TemperatureCharacteristic, instance),\n\t\t&ATMO_VARIABLE(TemperatureCharacteristic, bleServiceHandle), \n\t\tATMO_PROPERTY(TemperatureCharacteristic, bleServiceUuid));\n\t\n\tuint8_t property = 0;\n\tuint8_t permission = 0;\n\t\n\tproperty |= ATMO_PROPERTY(TemperatureCharacteristic, read) ? ATMO_BLE_Property_Read : 0;\n\tproperty |= ATMO_PROPERTY(TemperatureCharacteristic, write) ? ATMO_BLE_Property_Write : 0;\n\tproperty |= ATMO_PROPERTY(TemperatureCharacteristic, notify) ? ATMO_BLE_Property_Notify : 0;\n\n\tpermission |= ATMO_PROPERTY(TemperatureCharacteristic, read) ? ATMO_BLE_Permission_Read : 0;\n\tpermission |= ATMO_PROPERTY(TemperatureCharacteristic, write) ? ATMO_BLE_Permission_Write : 0;\n\n\tATMO_DATATYPE types[3] = {ATMO_PROPERTY(TemperatureCharacteristic, writeDataType), ATMO_PROPERTY(TemperatureCharacteristic, readDataType), ATMO_PROPERTY(TemperatureCharacteristic, notifyDataType)};\n\t\n\tATMO_BLE_GATTSAddCharacteristic(\n\t\tATMO_PROPERTY(TemperatureCharacteristic, instance),\n\t\t&ATMO_VARIABLE(TemperatureCharacteristic, bleCharacteristicHandle), \n\t\tATMO_VARIABLE(TemperatureCharacteristic, bleServiceHandle), \n\t\tATMO_PROPERTY(TemperatureCharacteristic, bleCharacteristicUuid), \n\t\tproperty, permission, ATMO_GetMaxValueSize(3, 64, types));\n\t\n\tATMO_BLE_GATTSRegisterCharacteristicAbilityHandle(\n\t\tATMO_PROPERTY(TemperatureCharacteristic, instance),\n\t\tATMO_VARIABLE(TemperatureCharacteristic, bleCharacteristicHandle), \n\t\tATMO_BLE_Characteristic_Written, \n\t\tATMO_ABILITY(TemperatureCharacteristic, written));\n\t\n\treturn ATMO_Status_Success;\n\t",
              "setValue": "\n\t\n\t// Convert to the desired write data type\n\tATMO_Value_t convertedValue;\n\tATMO_InitValue(&convertedValue);\n\tATMO_CreateValueConverted(&convertedValue, ATMO_PROPERTY(TemperatureCharacteristic, readDataType), in);\n\n\tATMO_BLE_GATTSSetCharacteristic(\n\t\tATMO_PROPERTY(TemperatureCharacteristic, instance),\n\t\tATMO_VARIABLE(TemperatureCharacteristic, bleCharacteristicHandle),\n\t\tconvertedValue.size, \n\t\t(uint8_t *)convertedValue.data,\n\t\tNULL);\n\t\n\tATMO_FreeValue(&convertedValue);\n\t\t\n\treturn ATMO_Status_Success;\n\t",
              "written": "\n\tATMO_CreateValueConverted(out, ATMO_PROPERTY(TemperatureCharacteristic, writeDataType), in);\n\treturn ATMO_Status_Success;\n\t",
              "subscibed": "\treturn ATMO_Status_Success;",
              "unsubscribed": "\treturn ATMO_Status_Success;"
            },
            "variables": {
              "bleServiceHandle": {
                "type": "ATMO_BLE_Handle_t"
              },
              "bleCharacteristicHandle": {
                "type": "ATMO_BLE_Handle_t"
              }
            },
            "embeddedPropertyConversions": {
              "bleServiceUuid": "string",
              "bleCharacteristicUuid": "string"
            },
            "codeUserChanged": {
              "setup": false,
              "setValue": false,
              "written": false,
              "subscibed": false,
              "unsubscribed": false
            },
            "instance": "ATMO_DRIVERINSTANCE_BLE_BLE1",
            "bleServiceUuid": "1493dd8e-8c3e-4e74-a4ff-6f0cd50005f9",
            "bleCharacteristicUuid": "1493dd8e-8c3e-4e76-a4ff-6f0cd50005f9",
            "read": true,
            "write": true,
            "notify": true,
            "readDataType": "ATMO_DATATYPE_FLOAT",
            "writeDataType": "ATMO_DATATYPE_FLOAT",
            "notifyDataType": "ATMO_DATATYPE_FLOAT"
          },
          "meta": {
            "editorX": 607.5000610351562,
            "editorY": 6,
            "lastTrigger": "written"
          },
          "triggers": {
            "triggered": [],
            "written": [],
            "subscibed": [],
            "unsubscribed": []
          },
          "interruptAbilities": {
            "trigger": false,
            "setup": false,
            "setValue": "valueSet",
            "written": true,
            "subscibed": true,
            "unsubscribed": true
          },
          "abilities": [
            {
              "name": "trigger",
              "triggers": [
                "triggered"
              ]
            },
            {
              "name": "setup",
              "triggers": []
            },
            {
              "name": "setValue",
              "triggers": []
            },
            {
              "name": "written",
              "triggers": [
                "written"
              ]
            },
            {
              "name": "subscibed",
              "triggers": [
                "subscibed"
              ]
            },
            {
              "name": "unsubscribed",
              "triggers": [
                "unsubscribed"
              ]
            }
          ]
        },
        {
          "name": "Temperature_P",
          "type": "EmbeddedIconLabelDisplay",
          "variants": [
            "embedded",
            "triggers",
            "abilities",
            "properties",
            "variables",
            "rpk"
          ],
          "properties": {
            "errorData": {},
            "code": {
              "trigger": "\treturn ATMO_Status_Success;",
              "displayPage": "\n\tATMO_UI_Page_DisplayPageByCoord(ATMO_PROPERTY(Temperature_P, x), ATMO_PROPERTY(Temperature_P, y), false);\n\treturn ATMO_Status_Success;\n\t",
              "onDisplayed": "\n\treturn ATMO_Status_Success;\n    ",
              "topRightButtonPressed": "\n\treturn ATMO_Status_Success;\n\t",
              "bottomRightButtonPressed": "\n\treturn ATMO_Status_Success;\n\t",
              "topLeftButtonPressed": "\n\treturn ATMO_Status_Success;\n\t",
              "bottomLeftButtonPressed": "\n\treturn ATMO_Status_Success;\n\t",
              "setup": "\n    ATMO_UI_PAGE_Config_t config;\n\tconfig.hidden = ATMO_PROPERTY(Temperature_P, pageHidden);\n\tconfig.textColor = ATMO_PROPERTY(Temperature_P, textColor);\n    config.activeButtons = ATMO_UI_Page_GetButtonMask(ATMO_PROPERTY(Temperature_P, topRightButtonEnabled),\n    ATMO_PROPERTY(Temperature_P,bottomRightButtonEnabled), ATMO_PROPERTY(Temperature_P, topLeftButtonEnabled), ATMO_PROPERTY(Temperature_P, bottomLeftButtonEnabled));\n\tconfig.x = ATMO_PROPERTY(Temperature_P, x);\n    config.x = ATMO_PROPERTY(Temperature_P, x);\n    config.y = ATMO_PROPERTY(Temperature_P, y);\n\tstrncpy(config.topLeftButtonLabel, ATMO_PROPERTY(Temperature_P, topLeftButtonLabel), ATMO_BUTTON_LABEL_MAXLEN);\n\tstrncpy(config.topRightButtonLabel, ATMO_PROPERTY(Temperature_P, topRightButtonLabel), ATMO_BUTTON_LABEL_MAXLEN);\n\tstrncpy(config.bottomLeftButtonLabel, ATMO_PROPERTY(Temperature_P, bottomLeftButtonLabel), ATMO_BUTTON_LABEL_MAXLEN);\n\tstrncpy(config.bottomRightButtonLabel, ATMO_PROPERTY(Temperature_P, bottomRightButtonLabel), ATMO_BUTTON_LABEL_MAXLEN);\n    config.spanX = ATMO_PROPERTY(Temperature_P, spanX);\n\tconfig.spanY = ATMO_PROPERTY(Temperature_P, spanY);\n    config.title = ATMO_PROPERTY(Temperature_P, pageTitle);\n    config.titleHidden = ATMO_PROPERTY(Temperature_P, titleHidden);\n\tATMO_UI_SINGLEICONTEXT_Init(&config);\n\tATMO_VARIABLE(Temperature_P, pageHandle) = config.templateInstance;\n    ATMO_UI_SINGLEICONTEXT_SetMainText(config.templateInstance, ATMO_PROPERTY(Temperature_P, label));\n    ATMO_UI_SINGLEICONTEXT_SetIcon(config.templateInstance, ATMO_PROPERTY(Temperature_P, icon));\n    ATMO_UI_SINGLEICONTEXT_RegisterOnDisplayedAbilityHandle(ATMO_VARIABLE(Temperature_P,pageHandle), ATMO_ABILITY(Temperature_P, onDisplayed));\n    ATMO_UI_SINGLEICONTEXT_RegisterButtonAbilityHandle(ATMO_VARIABLE(Temperature_P,pageHandle), 1, ATMO_ABILITY(Temperature_P, topRightButtonPressed));\n\tATMO_UI_SINGLEICONTEXT_RegisterButtonAbilityHandle(ATMO_VARIABLE(Temperature_P,pageHandle), 2, ATMO_ABILITY(Temperature_P, bottomRightButtonPressed));\n\tATMO_UI_SINGLEICONTEXT_RegisterButtonAbilityHandle(ATMO_VARIABLE(Temperature_P,pageHandle), 3, ATMO_ABILITY(Temperature_P, topLeftButtonPressed));\n    ATMO_UI_SINGLEICONTEXT_RegisterButtonAbilityHandle(ATMO_VARIABLE(Temperature_P,pageHandle), 4, ATMO_ABILITY(Temperature_P, bottomLeftButtonPressed));\n    ATMO_UI_SINGLEICONTEXT_RegisterOnLeaveAbilityHandle(config.templateInstance, ATMO_ABILITY(Temperature_P, onLeave));\n\treturn ATMO_Status_Success;\n    ",
              "onLeave": "\n\treturn ATMO_Status_Success;\n\t",
              "setLabel": "\n    char label[32];\n    if(ATMO_GetString(in, label, 32) == ATMO_Status_Success)\n    {\n        ATMO_UI_SINGLEICONTEXT_SetMainText(ATMO_VARIABLE(Temperature_P,pageHandle), label);\n    }\n    else\n    {\n        return ATMO_Status_Fail;\n    }\n\n    return ATMO_Status_Success;\n    "
            },
            "variables": {
              "pageHandle": {
                "type": "ATMO_DriverInstanceHandle_t"
              }
            },
            "embeddedPropertyConversions": {
              "pageTitle": "string",
              "topRightButtonLabel": "string",
              "bottomRightButtonLabel": "string",
              "topLeftButtonLabel": "string",
              "bottomLeftButtonLabel": "string",
              "label": "string"
            },
            "codeUserChanged": {
              "onDisplayed": false,
              "topRightButtonPressed": false,
              "bottomRightButtonPressed": false,
              "topLeftButtonPressed": false,
              "bottomLeftButtonPressed": false,
              "setup": false,
              "onLeave": false,
              "setLabel": false
            },
            "textColor": "GUI_BLACK",
            "pageTitle": "Temperature",
            "titleHidden": false,
            "pageHidden": false,
            "topRightButtonLabel": "",
            "topRightButtonEnabled": false,
            "bottomRightButtonLabel": "",
            "bottomRightButtonEnabled": false,
            "topLeftButtonLabel": "",
            "topLeftButtonEnabled": false,
            "bottomLeftButtonLabel": "",
            "bottomLeftButtonEnabled": false,
            "x": 0,
            "y": 0,
            "spanX": 1,
            "spanY": 1,
            "icon": "icon_applications_thermostat",
            "label": "N/A"
          },
          "meta": {
            "editorX": 190.33349609375,
            "editorY": 238,
            "lastTrigger": "onDisplayed"
          },
          "triggers": {
            "triggered": [],
            "onDisplayed": [],
            "topRightButtonPressed": [],
            "bottomRightButtonPressed": [],
            "topLeftButtonPressed": [],
            "bottomLeftButtonPressed": [],
            "onLeave": []
          },
          "interruptAbilities": {
            "trigger": false,
            "displayPage": false,
            "onDisplayed": false,
            "topRightButtonPressed": false,
            "bottomRightButtonPressed": false,
            "topLeftButtonPressed": false,
            "bottomLeftButtonPressed": false,
            "setup": false,
            "onLeave": false,
            "setLabel": false
          },
          "abilities": [
            {
              "name": "trigger",
              "triggers": [
                "triggered"
              ]
            },
            {
              "name": "displayPage",
              "triggers": []
            },
            {
              "name": "onDisplayed",
              "triggers": [
                "onDisplayed"
              ]
            },
            {
              "name": "topRightButtonPressed",
              "triggers": [
                "topRightButtonPressed"
              ]
            },
            {
              "name": "bottomRightButtonPressed",
              "triggers": [
                "bottomRightButtonPressed"
              ]
            },
            {
              "name": "topLeftButtonPressed",
              "triggers": [
                "topLeftButtonPressed"
              ]
            },
            {
              "name": "bottomLeftButtonPressed",
              "triggers": [
                "bottomLeftButtonPressed"
              ]
            },
            {
              "name": "setup",
              "triggers": []
            },
            {
              "name": "onLeave",
              "triggers": [
                "onLeave"
              ]
            },
            {
              "name": "setLabel",
              "triggers": []
            }
          ]
        },
        {
          "name": "Interval",
          "type": "EmbeddedInterval",
          "variants": [
            "embedded",
            "triggers",
            "abilities",
            "properties",
            "variables"
          ],
          "properties": {
            "errorData": {},
            "code": {
              "trigger": "\treturn ATMO_Status_Success;",
              "setup": "\n\tATMO_INTERVAL_Handle_t intervalHandle;\n    ATMO_INTERVAL_AddAbilityInterval(\n\t\tATMO_PROPERTY(Interval, instance), \n\t\tATMO_ABILITY(Interval, interval), \n\t\tATMO_PROPERTY(Interval, time), \n\t\t&intervalHandle\n\t);\n\t\n\treturn ATMO_Status_Success;\n\t",
              "interval": "\treturn ATMO_Status_Success;"
            },
            "variables": {},
            "embeddedPropertyConversions": {},
            "codeUserChanged": {
              "setup": false,
              "interval": false
            },
            "instance": "ATMO_DRIVERINSTANCE_INTERVAL_INTERVAL1",
            "time": "1000"
          },
          "meta": {
            "editorX": 34.16668701171875,
            "editorY": 230,
            "lastTrigger": "interval"
          },
          "triggers": {
            "triggered": [],
            "interval": [
              {
                "mapping": {},
                "targetOrder": [],
                "targetElement": "ENS210TemperatureHumidity",
                "targetAbility": "readTemperature"
              },
              {
                "mapping": {},
                "targetOrder": [],
                "targetElement": "ENS210TemperatureHumidity",
                "targetAbility": "readHumidity"
              }
            ]
          },
          "interruptAbilities": {
            "trigger": false,
            "setup": false,
            "interval": true
          },
          "abilities": [
            {
              "name": "trigger",
              "triggers": [
                "triggered"
              ]
            },
            {
              "name": "setup",
              "triggers": []
            },
            {
              "name": "interval",
              "triggers": [
                "interval"
              ]
            }
          ]
        },
        {
          "name": "GetTempStr",
          "type": "EmbeddedFunction",
          "variants": [
            "embedded",
            "triggers",
            "abilities",
            "properties",
            "variables"
          ],
          "properties": {
            "errorData": {},
            "code": {
              "trigger": "\tfloat temp = 0;\n\tATMO_GetFloat(in, &temp);\n\tchar str[32];\n\tsprintf(str, \"%.1f C\", temp);\n\tATMO_CreateValueString(out, str);\n\treturn ATMO_Status_Success;"
            },
            "variables": {},
            "embeddedPropertyConversions": {},
            "codeUserChanged": {
              "trigger": true
            }
          },
          "meta": {
            "editorX": 311.3333740234375,
            "editorY": 100,
            "lastTrigger": "triggered"
          },
          "triggers": {
            "triggered": [
              {
                "mapping": {},
                "targetOrder": [],
                "targetElement": "Temperature_P",
                "targetAbility": "setLabel"
              },
              {
                "mapping": {},
                "targetOrder": [],
                "targetElement": "EmbeddedComparison",
                "targetAbility": "evaluate"
              },
              {
                "mapping": {},
                "targetOrder": [],
                "targetElement": "EmbeddedComparison1",
                "targetAbility": "evaluate"
              },
              {
                "mapping": {},
                "targetOrder": [],
                "targetElement": "EmbeddedComparison2",
                "targetAbility": "evaluate"
              }
            ]
          },
          "interruptAbilities": {
            "trigger": false
          },
          "abilities": [
            {
              "name": "trigger",
              "triggers": [
                "triggered"
              ]
            }
          ]
        },
        {
          "name": "ENS210TemperatureHumidity",
          "type": "EmbeddedENS210",
          "variants": [
            "embedded",
            "triggers",
            "abilities",
            "properties",
            "variables"
          ],
          "properties": {
            "errorData": {},
            "code": {
              "trigger": "\treturn ATMO_Status_Success;",
              "setup": "\tATMO_ENS210_Config_t config;\n\tconfig.address = ATMO_PROPERTY(ENS210TemperatureHumidity, i2cAddress);\n\tconfig.i2cDriverInstance = ATMO_PROPERTY(ENS210TemperatureHumidity, i2cInstance);\n\tconfig.tempCalibrationOffset = ATMO_PROPERTY(ENS210TemperatureHumidity, tempCalibrationOffset);\n\n\treturn ( ATMO_ENS210_Init(&config) == ATMO_ENS210_Status_Success ) ? ATMO_Status_Success : ATMO_Status_Fail;\n",
              "setEnabled": "ATMO_ENS210_SetEnabled(true);\nreturn ATMO_Status_Success;",
              "setDisabled": "ATMO_ENS210_SetEnabled(false);\nreturn ATMO_Status_Success;",
              "setEnabledDisabled": "bool enabled = false;\nATMO_GetBool(in, &enabled);\nATMO_ENS210_SetEnabled(enabled);\nreturn ATMO_Status_Success;",
              "readTemperature": "    float tempC;\n    \n    if(ATMO_ENS210_GetTemperatureFloat(&tempC) == ATMO_ENS210_Status_Success)\n    {\n        ATMO_CreateValueFloat(out, tempC);\n    }\n    else\n    {\n        ATMO_CreateValueVoid(out);\n    }\n    \n    return ATMO_Status_Success;",
              "readHumidity": "    float humidityPct;\n\n    if(ATMO_ENS210_GetHumidityFloat(&humidityPct) == ATMO_ENS210_Status_Success)\n    {\n        ATMO_CreateValueFloat(out, humidityPct);\n    }\n    else\n    {\n        ATMO_CreateValueVoid(out);\n    }\n    \n    return ATMO_Status_Success;"
            },
            "variables": {},
            "embeddedPropertyConversions": {},
            "codeUserChanged": {
              "setup": false,
              "setEnabled": false,
              "setDisabled": false,
              "setEnabledDisabled": false,
              "readTemperature": false,
              "readHumidity": false
            },
            "i2cInstance": "ATMO_DRIVERINSTANCE_I2C_I2C2",
            "i2cAddress": "0x43",
            "tempCalibrationOffset": -7
          },
          "meta": {
            "editorX": 184.3333740234375,
            "editorY": 9,
            "lastTrigger": "humidityRead"
          },
          "triggers": {
            "triggered": [],
            "temperatureRead": [
              {
                "mapping": {},
                "targetOrder": [],
                "targetElement": "GetTempStr",
                "targetAbility": "trigger"
              },
              {
                "mapping": {},
                "targetOrder": [],
                "targetElement": "TemperatureCharacteristic",
                "targetAbility": "setValue"
              }
            ],
            "humidityRead": []
          },
          "interruptAbilities": {
            "trigger": false,
            "setup": false,
            "setEnabled": false,
            "setDisabled": false,
            "setEnabledDisabled": false,
            "readTemperature": false,
            "readHumidity": false
          },
          "abilities": [
            {
              "name": "trigger",
              "triggers": [
                "triggered"
              ]
            },
            {
              "name": "setup",
              "triggers": []
            },
            {
              "name": "setEnabled",
              "triggers": []
            },
            {
              "name": "setDisabled",
              "triggers": []
            },
            {
              "name": "setEnabledDisabled",
              "triggers": []
            },
            {
              "name": "readTemperature",
              "triggers": [
                "temperatureRead"
              ]
            },
            {
              "name": "readHumidity",
              "triggers": [
                "humidityRead"
              ]
            }
          ]
        },
        {
          "name": "EmbeddedComparison",
          "type": "EmbeddedComparison",
          "variants": [
            "embedded",
            "triggers",
            "abilities",
            "properties",
            "variables"
          ],
          "properties": {
            "errorData": {},
            "code": {
              "trigger": "\treturn ATMO_Status_Success;",
              "setup": "\n\treturn ATMO_Status_Success;\n\t",
              "evaluate": "\n\tbool conditionTrue = false;\n\n\t// Convert property to same type as input\n\tATMO_Value_t targetStr;\n\tATMO_Value_t targetNum;\n\t\n\tATMO_InitValue(&targetStr);\n\tATMO_InitValue(&targetNum);\n\tATMO_CreateValueString(&targetStr, ATMO_PROPERTY(EmbeddedComparison, target));\n\tATMO_CreateValueConverted(&targetNum, in->type, &targetStr);\n\t\n\tif(ATMO_CompareValues(in, &targetNum, ATMO_PROPERTY(EmbeddedComparison, condition), &conditionTrue) != ATMO_Status_Success)\n\t{\n\t\tATMO_Value_t value;\n\t\tATMO_InitValue(&value);\n\t\tATMO_TriggerHandler(ATMO_TRIGGER(EmbeddedComparison, invalidType), NULL);\n\t\tATMO_FreeValue(&value);\n\t\tATMO_FreeValue(&targetStr);\n\t\tATMO_FreeValue(&targetNum);\n\t\treturn ATMO_Status_Fail;\n\t}\n\n\tATMO_FreeValue(&targetStr);\n\tATMO_FreeValue(&targetNum);\n\n\tif(conditionTrue)\n\t{\n\t\tATMO_Value_t value;\n\t\tATMO_InitValue(&value);\n\t\tATMO_TriggerHandler(ATMO_TRIGGER(EmbeddedComparison, conditionTrue), NULL);\n\t\tATMO_FreeValue(&value);\t\t\n\t}\n\telse\n\t{\n\t\tATMO_Value_t value;\n\t\tATMO_InitValue(&value);\n\t\tATMO_TriggerHandler(ATMO_TRIGGER(EmbeddedComparison, conditionFalse), NULL);\n\t\tATMO_FreeValue(&value);\t\t\t\n\t}\n\n\treturn ATMO_Status_Success;\n\t"
            },
            "variables": {},
            "embeddedPropertyConversions": {
              "target": "string"
            },
            "codeUserChanged": {
              "setup": false,
              "evaluate": false
            },
            "condition": "ATMO_LESS_THAN_EQUAL",
            "target": "25"
          },
          "meta": {
            "editorX": 513.33349609375,
            "editorY": 102,
            "lastTrigger": "conditionTrue"
          },
          "triggers": {
            "triggered": [],
            "conditionTrue": [
              {
                "mapping": {},
                "targetOrder": [],
                "targetElement": "EmbeddedNxpRpkRgbLed",
                "targetAbility": "setGreenOn"
              }
            ],
            "conditionFalse": [],
            "invalidType": []
          },
          "interruptAbilities": {
            "trigger": false,
            "setup": false,
            "evaluate": false
          },
          "abilities": [
            {
              "name": "trigger",
              "triggers": [
                "triggered"
              ]
            },
            {
              "name": "setup",
              "triggers": []
            },
            {
              "name": "evaluate",
              "triggers": []
            }
          ]
        },
        {
          "name": "EmbeddedNxpRpkRgbLed",
          "type": "EmbeddedNxpRpkRgbLed",
          "variants": [
            "embedded",
            "triggers",
            "abilities",
            "properties",
            "variables",
            "rpk"
          ],
          "properties": {
            "errorData": {},
            "code": {
              "trigger": "\treturn ATMO_Status_Success;",
              "setup": "\n    RGB_Led_Set_State(RGB_LED_BRIGHT_HIGH, RGB_LED_COLOR_BLACK);\n\treturn ATMO_Status_Success;\n\t",
              "setColorPreset": "\n    unsigned int desiredColor = 0;\n    ATMO_GetUnsignedInt(in, &desiredColor);\n\n    uint8_t brightness = 0;\n    uint8_t color = 0;\n    RGB_Led_Get_State(&brightness, &color);\n    RGB_Led_Set_State(brightness, desiredColor);\n    return ATMO_Status_Success;\n    ",
              "setBrightnessLow": "\n    uint8_t brightness = 0;\n    uint8_t color = 0;\n    RGB_Led_Get_State(&brightness, &color);\n    RGB_Led_Set_State(RGB_LED_BRIGHT_LOW, color);\n    return ATMO_Status_Success;\n    ",
              "setBrightnessOff": "\n    uint8_t brightness = 0;\n    uint8_t color = 0;\n    RGB_Led_Get_State(&brightness, &color);\n    RGB_Led_Set_State(RGB_LED_BRIGHT_OFF, color);\n    return ATMO_Status_Success;\n    ",
              "setBrightnessMedium": "\n    uint8_t brightness = 0;\n    uint8_t color = 0;\n    RGB_Led_Get_State(&brightness, &color);\n    RGB_Led_Set_State(RGB_LED_BRIGHT_MEDIUM, color);\n    return ATMO_Status_Success;\n    ",
              "setBrightnessHigh": "\n    uint8_t brightness = 0;\n    uint8_t color = 0;\n    RGB_Led_Get_State(&brightness, &color);\n    RGB_Led_Set_State(RGB_LED_BRIGHT_HIGH, color);\n    return ATMO_Status_Success;\n    ",
              "setRedOn": "\n    RGB_Led_Set_State(RGB_LED_BRIGHT_HIGH, RGB_LED_COLOR_RED);\n\treturn ATMO_Status_Success;\n    ",
              "setGreenOn": "\n    RGB_Led_Set_State(RGB_LED_BRIGHT_HIGH, RGB_LED_COLOR_GREEN);\n\treturn ATMO_Status_Success;\n    ",
              "setBlueOn": "\n    RGB_Led_Set_State(RGB_LED_BRIGHT_HIGH, RGB_LED_COLOR_BLUE);\n\treturn ATMO_Status_Success;\n    ",
              "setWhiteOn": "\treturn ATMO_Status_Success;",
              "toggleRed": "\n\tuint8_t color, brightness;\n    RGB_Led_Get_State(&brightness, &color);\n    if(brightness == RGB_LED_BRIGHT_OFF || color == RGB_LED_COLOR_BLACK)\n    {\n        brightness = RGB_LED_BRIGHT_HIGH;\n    }\n    else\n    {\n        brightness = RGB_LED_BRIGHT_OFF;\n    }\n\n    RGB_Led_Set_State(brightness, RGB_LED_COLOR_RED);\n    return ATMO_Status_Success;\n\t",
              "toggleGreen": "\n\tuint8_t color, brightness;\n    RGB_Led_Get_State(&brightness, &color);\n    if(brightness == RGB_LED_BRIGHT_OFF || color == RGB_LED_COLOR_BLACK)\n    {\n        brightness = RGB_LED_BRIGHT_HIGH;\n    }\n    else\n    {\n        brightness = RGB_LED_BRIGHT_OFF;\n    }\n\n    RGB_Led_Set_State(brightness, RGB_LED_COLOR_GREEN);\n    return ATMO_Status_Success;\n\t",
              "toggleBlue": "\n\tuint8_t color, brightness;\n    RGB_Led_Get_State(&brightness, &color);\n    if(brightness == RGB_LED_BRIGHT_OFF || color == RGB_LED_COLOR_BLACK)\n    {\n        brightness = RGB_LED_BRIGHT_HIGH;\n    }\n    else\n    {\n        brightness = RGB_LED_BRIGHT_OFF;\n    }\n\n    RGB_Led_Set_State(brightness, RGB_LED_COLOR_BLUE);\n    return ATMO_Status_Success;\n\t",
              "setOff": "\n    uint8_t color, brightness;\n    RGB_Led_Get_State(&brightness, &color);\n    RGB_Led_Set_State(brightness, RGB_LED_COLOR_BLACK);\n\treturn ATMO_Status_Success;\n    ",
              "setColorHex": "\n    unsigned int color = 0;\n    ATMO_GetUnsignedInt(in, &color);\n    uint8_t red = (color >> 16) & 0xFF;\n    uint8_t green = (color >> 8) & 0xFF;\n    uint8_t blue = color & 0xFF;\n    Rgb_Led_Set_Colors(red, green, blue);  \n    ATMO_CreateValueUnsignedInt(out, color);\n\treturn ATMO_Status_Success;\n    "
            },
            "variables": {},
            "embeddedPropertyConversions": {},
            "codeUserChanged": {
              "setup": false,
              "setColorPreset": false,
              "setBrightnessLow": false,
              "setBrightnessOff": false,
              "setBrightnessMedium": false,
              "setBrightnessHigh": false,
              "setRedOn": false,
              "setGreenOn": false,
              "setBlueOn": false,
              "setWhiteOn": false,
              "toggleRed": false,
              "toggleGreen": false,
              "toggleBlue": false,
              "setOff": false,
              "setColorHex": false
            }
          },
          "meta": {
            "editorX": 704.33349609375,
            "editorY": 90,
            "lastTrigger": "colorSet"
          },
          "triggers": {
            "triggered": [],
            "brightnessSet": [],
            "colorSet": []
          },
          "interruptAbilities": {
            "trigger": false,
            "setup": false,
            "setColorPreset": false,
            "setBrightnessLow": false,
            "setBrightnessOff": false,
            "setBrightnessMedium": false,
            "setBrightnessHigh": false,
            "setRedOn": false,
            "setGreenOn": false,
            "setBlueOn": false,
            "setWhiteOn": false,
            "toggleRed": false,
            "toggleGreen": false,
            "toggleBlue": false,
            "setOff": false,
            "setColorHex": false
          },
          "abilities": [
            {
              "name": "trigger",
              "triggers": [
                "triggered"
              ]
            },
            {
              "name": "setup",
              "triggers": []
            },
            {
              "name": "setColorPreset",
              "triggers": []
            },
            {
              "name": "setBrightnessLow",
              "triggers": [
                "brightnessSet"
              ]
            },
            {
              "name": "setBrightnessOff",
              "triggers": [
                "brightnessSet"
              ]
            },
            {
              "name": "setBrightnessMedium",
              "triggers": [
                "brightnessSet"
              ]
            },
            {
              "name": "setBrightnessHigh",
              "triggers": [
                "brightnessSet"
              ]
            },
            {
              "name": "setRedOn",
              "triggers": []
            },
            {
              "name": "setGreenOn",
              "triggers": []
            },
            {
              "name": "setBlueOn",
              "triggers": []
            },
            {
              "name": "setWhiteOn",
              "triggers": []
            },
            {
              "name": "toggleRed",
              "triggers": []
            },
            {
              "name": "toggleGreen",
              "triggers": []
            },
            {
              "name": "toggleBlue",
              "triggers": []
            },
            {
              "name": "setOff",
              "triggers": []
            },
            {
              "name": "setColorHex",
              "triggers": [
                "colorSet"
              ]
            }
          ]
        },
        {
          "name": "EmbeddedComparison1",
          "type": "EmbeddedComparison",
          "variants": [
            "embedded",
            "triggers",
            "abilities",
            "properties",
            "variables"
          ],
          "properties": {
            "errorData": {},
            "code": {
              "trigger": "\treturn ATMO_Status_Success;",
              "setup": "\n\treturn ATMO_Status_Success;\n\t",
              "evaluate": "\n\tbool conditionTrue = false;\n\n\t// Convert property to same type as input\n\tATMO_Value_t targetStr;\n\tATMO_Value_t targetNum;\n\t\n\tATMO_InitValue(&targetStr);\n\tATMO_InitValue(&targetNum);\n\tATMO_CreateValueString(&targetStr, ATMO_PROPERTY(EmbeddedComparison1, target));\n\tATMO_CreateValueConverted(&targetNum, in->type, &targetStr);\n\t\n\tif(ATMO_CompareValues(in, &targetNum, ATMO_PROPERTY(EmbeddedComparison1, condition), &conditionTrue) != ATMO_Status_Success)\n\t{\n\t\tATMO_Value_t value;\n\t\tATMO_InitValue(&value);\n\t\tATMO_TriggerHandler(ATMO_TRIGGER(EmbeddedComparison1, invalidType), NULL);\n\t\tATMO_FreeValue(&value);\n\t\tATMO_FreeValue(&targetStr);\n\t\tATMO_FreeValue(&targetNum);\n\t\treturn ATMO_Status_Fail;\n\t}\n\n\tATMO_FreeValue(&targetStr);\n\tATMO_FreeValue(&targetNum);\n\n\tif(conditionTrue)\n\t{\n\t\tATMO_Value_t value;\n\t\tATMO_InitValue(&value);\n\t\tATMO_TriggerHandler(ATMO_TRIGGER(EmbeddedComparison1, conditionTrue), NULL);\n\t\tATMO_FreeValue(&value);\t\t\n\t}\n\telse\n\t{\n\t\tATMO_Value_t value;\n\t\tATMO_InitValue(&value);\n\t\tATMO_TriggerHandler(ATMO_TRIGGER(EmbeddedComparison1, conditionFalse), NULL);\n\t\tATMO_FreeValue(&value);\t\t\t\n\t}\n\n\treturn ATMO_Status_Success;\n\t"
            },
            "variables": {},
            "embeddedPropertyConversions": {
              "target": "string"
            },
            "codeUserChanged": {
              "setup": false,
              "evaluate": false
            },
            "condition": "ATMO_GREATER_THAN",
            "target": "25"
          },
          "meta": {
            "editorX": 516.33349609375,
            "editorY": 178,
            "lastTrigger": "conditionTrue"
          },
          "triggers": {
            "triggered": [],
            "conditionTrue": [
              {
                "mapping": {},
                "targetOrder": [],
                "targetElement": "EmbeddedNxpRpkRgbLed1",
                "targetAbility": "toggleRed"
              }
            ],
            "conditionFalse": [],
            "invalidType": []
          },
          "interruptAbilities": {
            "trigger": false,
            "setup": false,
            "evaluate": false
          },
          "abilities": [
            {
              "name": "trigger",
              "triggers": [
                "triggered"
              ]
            },
            {
              "name": "setup",
              "triggers": []
            },
            {
              "name": "evaluate",
              "triggers": []
            }
          ]
        },
        {
          "name": "EmbeddedNxpRpkRgbLed1",
          "type": "EmbeddedNxpRpkRgbLed",
          "variants": [
            "embedded",
            "triggers",
            "abilities",
            "properties",
            "variables",
            "rpk"
          ],
          "properties": {
            "errorData": {},
            "code": {
              "trigger": "\treturn ATMO_Status_Success;",
              "setup": "\n    RGB_Led_Set_State(RGB_LED_BRIGHT_HIGH, RGB_LED_COLOR_BLACK);\n\treturn ATMO_Status_Success;\n\t",
              "setColorPreset": "\n    unsigned int desiredColor = 0;\n    ATMO_GetUnsignedInt(in, &desiredColor);\n\n    uint8_t brightness = 0;\n    uint8_t color = 0;\n    RGB_Led_Get_State(&brightness, &color);\n    RGB_Led_Set_State(brightness, desiredColor);\n    return ATMO_Status_Success;\n    ",
              "setBrightnessLow": "\n    uint8_t brightness = 0;\n    uint8_t color = 0;\n    RGB_Led_Get_State(&brightness, &color);\n    RGB_Led_Set_State(RGB_LED_BRIGHT_LOW, color);\n    return ATMO_Status_Success;\n    ",
              "setBrightnessOff": "\n    uint8_t brightness = 0;\n    uint8_t color = 0;\n    RGB_Led_Get_State(&brightness, &color);\n    RGB_Led_Set_State(RGB_LED_BRIGHT_OFF, color);\n    return ATMO_Status_Success;\n    ",
              "setBrightnessMedium": "\n    uint8_t brightness = 0;\n    uint8_t color = 0;\n    RGB_Led_Get_State(&brightness, &color);\n    RGB_Led_Set_State(RGB_LED_BRIGHT_MEDIUM, color);\n    return ATMO_Status_Success;\n    ",
              "setBrightnessHigh": "\n    uint8_t brightness = 0;\n    uint8_t color = 0;\n    RGB_Led_Get_State(&brightness, &color);\n    RGB_Led_Set_State(RGB_LED_BRIGHT_HIGH, color);\n    return ATMO_Status_Success;\n    ",
              "setRedOn": "\n    RGB_Led_Set_State(RGB_LED_BRIGHT_HIGH, RGB_LED_COLOR_RED);\n\treturn ATMO_Status_Success;\n    ",
              "setGreenOn": "\n    RGB_Led_Set_State(RGB_LED_BRIGHT_HIGH, RGB_LED_COLOR_GREEN);\n\treturn ATMO_Status_Success;\n    ",
              "setBlueOn": "\n    RGB_Led_Set_State(RGB_LED_BRIGHT_HIGH, RGB_LED_COLOR_BLUE);\n\treturn ATMO_Status_Success;\n    ",
              "setWhiteOn": "\treturn ATMO_Status_Success;",
              "toggleRed": "\n\tuint8_t color, brightness;\n    RGB_Led_Get_State(&brightness, &color);\n    if(brightness == RGB_LED_BRIGHT_OFF || color == RGB_LED_COLOR_BLACK)\n    {\n        brightness = RGB_LED_BRIGHT_HIGH;\n    }\n    else\n    {\n        brightness = RGB_LED_BRIGHT_OFF;\n    }\n\n    RGB_Led_Set_State(brightness, RGB_LED_COLOR_RED);\n    return ATMO_Status_Success;\n\t",
              "toggleGreen": "\n\tuint8_t color, brightness;\n    RGB_Led_Get_State(&brightness, &color);\n    if(brightness == RGB_LED_BRIGHT_OFF || color == RGB_LED_COLOR_BLACK)\n    {\n        brightness = RGB_LED_BRIGHT_HIGH;\n    }\n    else\n    {\n        brightness = RGB_LED_BRIGHT_OFF;\n    }\n\n    RGB_Led_Set_State(brightness, RGB_LED_COLOR_GREEN);\n    return ATMO_Status_Success;\n\t",
              "toggleBlue": "\n\tuint8_t color, brightness;\n    RGB_Led_Get_State(&brightness, &color);\n    if(brightness == RGB_LED_BRIGHT_OFF || color == RGB_LED_COLOR_BLACK)\n    {\n        brightness = RGB_LED_BRIGHT_HIGH;\n    }\n    else\n    {\n        brightness = RGB_LED_BRIGHT_OFF;\n    }\n\n    RGB_Led_Set_State(brightness, RGB_LED_COLOR_BLUE);\n    return ATMO_Status_Success;\n\t",
              "setOff": "\n    uint8_t color, brightness;\n    RGB_Led_Get_State(&brightness, &color);\n    RGB_Led_Set_State(brightness, RGB_LED_COLOR_BLACK);\n\treturn ATMO_Status_Success;\n    ",
              "setColorHex": "\n    unsigned int color = 0;\n    ATMO_GetUnsignedInt(in, &color);\n    uint8_t red = (color >> 16) & 0xFF;\n    uint8_t green = (color >> 8) & 0xFF;\n    uint8_t blue = color & 0xFF;\n    Rgb_Led_Set_Colors(red, green, blue);  \n    ATMO_CreateValueUnsignedInt(out, color);\n\treturn ATMO_Status_Success;\n    "
            },
            "variables": {},
            "embeddedPropertyConversions": {},
            "codeUserChanged": {
              "setup": false,
              "setColorPreset": false,
              "setBrightnessLow": false,
              "setBrightnessOff": false,
              "setBrightnessMedium": false,
              "setBrightnessHigh": false,
              "setRedOn": false,
              "setGreenOn": false,
              "setBlueOn": false,
              "setWhiteOn": false,
              "toggleRed": false,
              "toggleGreen": false,
              "toggleBlue": false,
              "setOff": false,
              "setColorHex": false
            }
          },
          "meta": {
            "editorX": 706.33349609375,
            "editorY": 172,
            "lastTrigger": "colorSet"
          },
          "triggers": {
            "triggered": [],
            "brightnessSet": [],
            "colorSet": []
          },
          "interruptAbilities": {
            "trigger": false,
            "setup": false,
            "setColorPreset": false,
            "setBrightnessLow": false,
            "setBrightnessOff": false,
            "setBrightnessMedium": false,
            "setBrightnessHigh": false,
            "setRedOn": false,
            "setGreenOn": false,
            "setBlueOn": false,
            "setWhiteOn": false,
            "toggleRed": false,
            "toggleGreen": false,
            "toggleBlue": false,
            "setOff": false,
            "setColorHex": false
          },
          "abilities": [
            {
              "name": "trigger",
              "triggers": [
                "triggered"
              ]
            },
            {
              "name": "setup",
              "triggers": []
            },
            {
              "name": "setColorPreset",
              "triggers": []
            },
            {
              "name": "setBrightnessLow",
              "triggers": [
                "brightnessSet"
              ]
            },
            {
              "name": "setBrightnessOff",
              "triggers": [
                "brightnessSet"
              ]
            },
            {
              "name": "setBrightnessMedium",
              "triggers": [
                "brightnessSet"
              ]
            },
            {
              "name": "setBrightnessHigh",
              "triggers": [
                "brightnessSet"
              ]
            },
            {
              "name": "setRedOn",
              "triggers": []
            },
            {
              "name": "setGreenOn",
              "triggers": []
            },
            {
              "name": "setBlueOn",
              "triggers": []
            },
            {
              "name": "setWhiteOn",
              "triggers": []
            },
            {
              "name": "toggleRed",
              "triggers": []
            },
            {
              "name": "toggleGreen",
              "triggers": []
            },
            {
              "name": "toggleBlue",
              "triggers": []
            },
            {
              "name": "setOff",
              "triggers": []
            },
            {
              "name": "setColorHex",
              "triggers": [
                "colorSet"
              ]
            }
          ]
        },
        {
          "name": "EmbeddedNxpRpkBuzzer",
          "type": "EmbeddedNxpRpkBuzzer",
          "variants": [
            "embedded",
            "triggers",
            "abilities",
            "properties",
            "variables",
            "rpk"
          ],
          "properties": {
            "errorData": {},
            "code": {
              "trigger": "\treturn ATMO_Status_Success;",
              "setup": "\n\treturn ATMO_Status_Success;\n    ",
              "beep": "\n    ATMO_MK64F_Buzzer_On();\n    ATMO_PLATFORM_DelayMilliseconds(200);\n    ATMO_MK64F_Buzzer_Off();\n\treturn ATMO_Status_Success;\n    ",
              "turnOn": "\n    ATMO_MK64F_Buzzer_On();\n    ATMO_CreateValueBool(out, true);\n\treturn ATMO_Status_Success;\n    ",
              "turnOff": "\n    ATMO_MK64F_Buzzer_Off();\n    ATMO_CreateValueBool(out, false);\n\treturn ATMO_Status_Success;\n    ",
              "toggle": "\n    bool newState = false;\n    ATMO_MK64F_Buzzer_Toggle(&newState);\n    ATMO_CreateValueBool(out, newState);\n\treturn ATMO_Status_Success;\n    ",
              "setState": "\n    bool on = false;\n    ATMO_GetBool(in, &on);\n\n    if( on )\n    {\n        ATMO_MK64F_Buzzer_On();\n    }\n    else\n    {\n        ATMO_MK64F_Buzzer_Off();\n    }\n    ATMO_CreateValueBool(out, on);\n    \n\treturn ATMO_Status_Success;\n    "
            },
            "variables": {},
            "embeddedPropertyConversions": {},
            "codeUserChanged": {
              "setup": false,
              "beep": false,
              "turnOn": false,
              "turnOff": false,
              "toggle": false,
              "setState": false
            }
          },
...

This file has been truncated, please download it to see its full contents.

Credits

Samuel Lopez

Samuel Lopez

2 projects • 1 follower
Engineering control and automation in UDistrital , passionate about programming learn microcontrollers # Labview # microchip # mbed

Comments