The best tools to make your project dreams come true

Login or Signup
USD

11/6/2019 | By Maker.io Staff

How to Use DK IoT Studio Application Logic Elements

As you may know, the Digi-Key IoT Studio provides a graphical method for creating applications, where elements are connected with arrows, which perform actions when an event has occurred. Additionally, Digi-Key IoT Studio combines IoT devices with mobile apps and also provides an app maker, which uses elements that can be connected together. This leads to the question: what elements are available in the application builder and what can they do?

BOM

Application Logic

Application logic elements are used to create the app’s core. These elements include timers, averaging, web communications, and conditions.

NFC

The NFC element is used for “Near Field Communication” a common short-range radio technology. Contactless debit cards, which are used to speed up a payment process, generally for small transactions, are just one example of widespread NFC technology. The NFC element can perform many tasks, including reading metadata and emptying records.

How to Use DK IoT Studio Application Logic Elements

Buffer

The buffer element is used to hold values in a stack, which can be retrieved later. The buffer element can have its index changed so that any element can be selected, have values pushed to it, have values pop from it, be spliced, and cleared. In cases where an internet connection may not be available, the buffer element is very useful.

How to Use DK IoT Studio Application Logic Elements

Average

The average element is used for averaging samples, such as data from a sensor. This element is similar to the buffer in that values can be pushed to it. However, the average element can have a set sample size, meaning that new data being added to the average element will remove old data, which ensures you have an up-to-date averaged value.

How to Use DK IoT Studio Application Logic Elements

Condition

The condition element simply compares the input to a condition, and if that condition is met, the elements connected to the condition are triggered.

How to Use DK IoT Studio Application Logic Elements

Expression

The expression element, which is rather advanced, allows for custom JavaScript code. The custom JavaScript is evaluated to produce a value and is useful in scenarios where there may be a complex mathematical operation or some evaluation of data. Values can be set in the expression, and the expression can be calculated to produce an output.

How to Use DK IoT Studio Application Logic Elements

For Each

The “ForEach” element is a classic function that is often used in typical programming. The element is a loop function that typically takes all of the values in a buffer element and then iterates through each value. From there, each value can be passed into other elements for processing. An example of this would be sending each value to the cloud when an internet connection has been established to publish new sensor readings.

How to Use DK IoT Studio Application Logic Elements

Interval

The interval element fires repeatedly after a predetermined time interval and is useful for frequently checking on data. For example, it is needed when reading up-to-date information from a Bluetooth element.

How to Use DK IoT Studio Application Logic Elements

Web Link

The “WebLink” element is used to open the user’s browser and navigate to a specified web page. This can be useful for “about” buttons and other buttons that open website pages.

How to Use DK IoT Studio Application Logic Elements

Web IO

The “WebIO” element is a fairly powerful element that gives your application the capability to interact with websites via GET and POST HTTP commands. A webpage can be obtained using this element, or data can be submitted to a PHP page, which can be further processed.

How to Use DK IoT Studio Application Logic Elements

Cloud

Cloud elements are used to interact with the cloud service provided by Digi-Key IoT. This is important if you want to have dashboards capable of showing data on graphs, charts, and other GUI elements.

Cloud Event

The “CloudEvent1” element is used to send events, which can have values attached to them, to the cloud. For example, a cloud event can be triggered on an interval whereby sensor data in a buffer can be sent for display on a chart.

How to Use DK IoT Studio Application Logic Elements

Cloud Command

The “CloudCommand” element makes it possible for commands to be sent by the cloud to an application. It can be used to trigger other actions, get variable data, change the state of GUI elements on the application, and much more!

How to Use DK IoT Studio Application Logic Elements

Application Interface

The application interface elements are arguably the most important ones. They make up the visual aspect of your app, including buttons, sliders, analog displays, and progress bars!

Button

The button element is used to interact with a button and can obtain the value of a button or perform an action once it is pressed.

How to Use DK IoT Studio Application Logic Elements

Checkbox

The checkbox element is used for interacting with a checkbox on the app. These can be useful in situations where a toggle switch does not make practical sense and when a single press needs to remember an option. For example, an enabled option would be better done with a checkbox, as checking the box implies “yes,” whereas a toggle switch can be more obscure.

How to Use DK IoT Studio Application Logic Elements

Toggle

The toggle switch is similar to a button, but unlike the button, the toggle switch remembers its state, meaning that it can be toggled between on and off. The “Toggle1” element can trigger other elements when its option is changed, and the value of the toggle can be passed on. Turning on and off GPIO is just one common use of a toggle switch.

How to Use DK IoT Studio Application Logic Elements

Image

The image element is used to display an image and is useful for displaying branding, company logos, and general beautification of the application. The image can be changed through other elements, allowing for a possible dynamic GUI indicator. For example, a temperature sensor reading could be used to change the image from a cool indicator to a hot indicator.

How to Use DK IoT Studio Application Logic Elements

Label

The label, which is used to display text, is a very helpful element. The text itself, as well as visibility, color, and size, can be changed by other elements.

How to Use DK IoT Studio Application Logic Elements

Progress Bar

The “ProgressBar” element shows a progress bar whose value can be changed, boundaries adjusted, and visibility changed by other connected elements. This element is useful in situations when some form of progression needs to be visualized. For example, data in a buffer that gets sent to a cloud can use the progress bar to show how much of the data has been submitted.

How to Use DK IoT Studio Application Logic Elements

Analog Meter

The analog meter is a graphical dial that can be used to display analog values. This is a very handy element when reading from sensors that produce analog values, such as temperature, pressure, humidity, and direction. Its value can be changed, its bounds can be adjusted, and visibility can be adjusted.

How to Use DK IoT Studio Application Logic Elements

Slider

The slider is an input element that allows the user to adjust a value by sliding a notch. This element is useful in situations where the user needs to adjust an analog value such as volume, brightness, and color.

How to Use DK IoT Studio Application Logic Elements

Understanding these elements will be key as we move into more advanced and involved projects in the future!

For more IoT solutions information see Digi-Key’s IoT Solutions and or go direct to DK IoT Studio here.

For other projects and blogs related to DK IoT Studio click this link.