Patch Documentation

  • A2.1 RGB Led

  • I2C

  • I/O

  • Pressure

  • Toggle

  • Threshold

  • Value generator

  • Stepper

  • Compare

  • Timer

  • Range

  • Device

  • EL Driver

  • Temperature/Humidity

  • Accelerometer/gyroscope

  • A2

  • Speech synthesis

  • Speech recognition

  • Update data

  • Save data

  • Remove data

  • Fetch data

  • Reaction game engine

  • Button

  • String/Number

  • Waveform/random

  • Time

  • Group

  • Navigation

  • Monitor georegion

  • Location

  • Geocoder

  • Philips HUE

  • Spotify

  • QR Code reader

  • NFC Tag reader

  • User info

  • Trigger

  • Timer

  • Switch

  • String operations

  • Stepper

  • State

  • Split list

  • Range

  • Orientation (Kalman filter)

  • Number to string

  • Math

  • List builder

  • Funnel

  • Flow start/stop

  • Flag

  • Debug

  • Compare

  • Calibrate gyro

  • Working with JSON

  • Websocket

  • OAuth 1.0

  • MQTT

  • HTTP

  • Convert from JSON / Parse JSON

  • Convert to JSON / JSON Creator

  • IOS Pedometer

  • IOS Motion and altitude

  • IOS Motion activity

  • IOS Notification

  • Vibrate

  • Design page

  • Background gradient

  • Background color

  • Web view

  • Picker view

  • Map view

  • Design group

  • Date picker view

  • 3D View

  • Plot

  • Text input

  • Text label

  • Roundable object

  • Design button

  • Design switch

  • Design slider

  • Working with design components

A2.1 RGB Led


Control the RGB LED of the A2.1. Send 1/0 for on/off to any of the inputs.

Inputs

– Red in

– Green in

– Blue in

Outputs

Settings

I2C


Send I2C commands to external hardware connected to the A2 using this patch. The patch has 8 inputs and for each input you can enter a command in the In X Data setting in the settings view. You also specify the type of command, if it’s write or read in the In X Read/Write setting for the input/output you’re using. Finally you need to configure the I2C Address setting to specify the I2C Address of the device you’re sending the data to.

There is one option of the Read/write setting called Write, append data where any value sent to the input you’re configuring will be appended to the command specified in In X Data. For some cases, you might need to send more than one command to perform some kind of setup of an external device e.g. In this case, you can write several commands to one input.

When using the Read command, you also need to specify the response type in the Response type setting and the expected length of the response in Response length. For this, you’ll have to read the documentation of the external hardware that you’re communicating with.  E.g, the response might be 4 bytes and the type is UInt8. So in that case you’d configure Response type to UInt8 and set Response length to 4.

Inputs

– I2C 1 in

– I2C 2 in

– I2C 3 in

– I2C 4 in

– I2C 5 in

– I2C 6 in

– I2C 7 in

– I2C 8 in

Outputs

– I2C 1 Out

– I2C 2 Out

– I2C 3 Out

– I2C 4 Out

– I2C 5 Out

– I2C 6 Out

– I2C 7 Out

– I2C 8 Out

Settings

For every one of the 8 inputs/outputs

Replace X with 1 – 8 for that port to be configured.

– In X Read/Write

– In X I2C Address

– In X Data

– In X Response type

– In X Response length

I/O


Use this patch to access the I/O ports of the A2. The A2 (A2.1) has 6 I/O ports that can be configured to use analog in/out or digital in/out. If you configure one port to be a digital or analog output and connect an external component to that I/O pin on the A2, you’ll send values to the input for that port to this patch. E.g, you want to connect a Toggle patch to be able to turn on/off an LED that you’ve connected externally to the A2. The LED is soldered to pin 0, that means that you need to connect the output of the toggle patch to Pin 0 in of the I/O patch. You also have to change the settings of the I/O patch and set Pin 0 mode to Digital out.

Another example could be having a simple button controlling the LED of the A2. The button is soldered to pin 0 of the A2. You make a connection between Pin 0 out of the I/O patch to one of the inputs of the LED patch and in the settings view of the I/O patch, you configure the Pin 0 mode to Digital in.

The same principle is true for analog in and analog out.

To access the physical I/O pins of the A2, you need to connect the A2 to an extension board.

Digital values are either 1 or 0 and analog values can be in the range between 0 – 4095.

Outputs

– Pin 0 in

– Pin 1 in

– Pin 2 in

– Pin 3 in

– Pin 4 in

– Pin 5 in

– Pin 6 in

– Pin 7 in

Outputs

– Pin 0 out

– Pin 1 out

– Pin 2 out

– Pin 3 out

– Pin 4 out

– Pin 5 out

– Pin 6 out

– Pin 7 out

Settings

– Pin 0 mode

– Pin 1 mode

– Pin 2 mode

– Pin 3 mode

– Pin 4 mode

– Pin 5 mode

Pressure


Access the pressure sensor of the A2 using this patch. Raw pressure sensor data is sent on the Pressure output.

Inputs

Outputs

– Pressure

Settings

Toggle


Send a value to any of the 8 inputs which will trigger 1/0 on the corresponding output. So, every second time 1 and every second time 0. The value sent to the input must be either 1 or 0.

Inputs

– Toggle 1 in

– Toggle 2 in

– Toggle 3 in

– Toggle 4 in

– Toggle 5 in

– Toggle 6 in

– Toggle 7 in

– Toggle 8 in

Outputs

– Toggle 1 out

– Toggle 2 out

– Toggle 3 out

– Toggle 4 out

– Toggle 5 out

– Toggle 6 out

– Toggle 7 out

– Toggle 8 out

Settings

Threshold


Use the threshold patch to reduce data. E.g, if you’re sending temperature values to an output but you only want to send data when the temperature has changed by 1°C, you can use this patch. The patch can handle a list of 8 values, and for that reason there are 8 different settings. When certain patches are connected, the settings view adapts itself and gives the limit labels appropriate names, e.g. accelerometer x,y,z. The limit you’re defining tells the patch how much a new incoming value on Value in must differ from the last value it sent on Value out in order for the patch to send that value and save it as the new last value.

When defining a list of limits, the patch checks all the values in an incoming list to see if one of the values is above or below the saved value +- the limit. So, for accelerometer x,y,z, an incoming x value will be checked against the last saved x value and so on.

An example use case would be saving temperature values on the memory of the A2, but only when the temperature has changed by 1 degree. We would add a temperature/humidity patch and connect the temperature output to Value in of the threshold patch. We would set limit 1 to 1 in the settings of the threshold patch. Finally we would connect Value out of the threshold patch to a log output of the A2 patch (you can add it on the A2 patch itself by tapping Tap for additional). If the first temperature value received by this patch is 20°C, it will pass the threshold patch and will be stored in the A2’s memory. The next temperature value is also 20 and will not pass through the threshold patch. The next value is 21 °C and since it’s one degree above 20 it will pass through the threshold. The next value is also 21°C and it will not pass through since now the next temperature value must be 1°C greater or smaller than 21°C.

Inputs

– Reset

– Value in

Outputs

– Value out

Settings

– Limit 1

– Limit 2

– Limit 3

– Limit 4

– Limit 5

– Limit 6

– Limit 7

– Limit 8

Value generator


Any value sent on any of the inputs will trigger the value set by the Value setting to be sent on the Value out output.

Inputs

– Trigger in 1

– Trigger in 2

– Trigger in 3

– Trigger in 4

– Trigger in 5

– Trigger in 6

– Trigger in 7

– Trigger in 8

Outputs

– Value out

Settings

– Value

Stepper


The stepper patch has one input named Value in and 8 outputs. It has one setting called Step from output 1 up to that defines how many outputs will be used. When a value is received on the input, it will forwarded on the last output + 1. So, if the value was forwarded on output 1 the last time, it will be forwarded on output 2 the next. When a value has been forwarded on the last output to be used, it starts again with output 1 and counts up.

It’s important to keep in mind that if the Playground app is no longer in the foreground (you’ve switched to another app or closed the screen), the speech recognition will stop due to limitations by Apple.

Apple recommends that it should be clearly shown in the UI of the app (flow in the case of Playground) that the microphone is turned on.

Inputs

– Value in

Outputs

– Step 1 out

– Step 2 out

– Step 3 out

– Step 4 out

– Step 5 out

– Step 6 out

– Step 7 out

– Step 8 out

Settings

– Step from output 1 up to

Compare


The compare patch is used to compare incoming values against the values defined in the settings of the patch. The compare patch can handle a list of 8 values, hence the 8 input fields for the threshold values. When certain patches are connected, the settings view adapts itself and gives the threshold labels appropriate names, e.g. accelerometer x,y,z. The compare patch has different outputs for handling the compare operations \”=\”, \”<\” and \”>\”. For each of these operations there are 2 outputs. One which will send the value 1 or 0, depending on if the comparison is true or false. The other output will forward the incoming value if the comparison is true. Say that you set the first threshold value to 10 and connect something to Value in. If the value 10 is received on this input, it will send this value on the output named Equal value out. It will also send the value 1 on Equal out. Nothing will be sent on Greater than value out and Smaller than value out. But on the outputs Greater than and Smaller than, the value 0 will be sent. The outputs can be used for different use cases. Sometimes you want to trigger something only if the comparison is true, for this one of the value outputs can be useful. In other cases it might be useful to get a 1 or 0 depending on if the comparison is true or not, e.g if you want to control a light when a certain condition is true.

Inputs

– Value in

Outputs

– Equal out

– Equal value out

– Greater than

– Greater than value out

– smaller than

– Smaller than value out

– Error out

Settings

– Threshold 1

– Threshold 2

– Threshold 3

– Threshold 4

– Threshold 5

– Threshold 6

– Threshold 7

– Threshold 8

Timer


This patch has 8 outputs. In the settings view, you specify for each output at what time a value should be sent from the output. The value you specify is the number of system ticks and depends on the current update rate of the A2. The default value is 19 ms. So, a value of 3 for Output 1 count means that a value will be sent every 19 * 3 ms on Counter 1 output. The patch has a setting called Mode that decides if the counting should start when a value is received on Trigger count or if it should run continuously. For the Trigger count mode, the outputs with a value above 0 will be triggered once. The patch also has an input named ON/OFF to turn it on/off by sending 1 or 0 to it for on or off of the continuous mode.

Inputs

– ON/OFF

– Trigger count

Outputs

– Counter 1

– Counter 2

– Counter 3

– Counter 4

– Counter 5

– Counter 6

– Counter 7

– Counter 8

Settings

– Mode

– Output 1 count

– Output 2 count

– Output 3 count

– Output 4 count

– Output 5 count

– Output 6 count

– Output 7 count

– Output 8 count

Range


Use this patch to scale values between two ranges. If a value received on the Value in input is in the input range that is set with the Input range min and Input range max settings, it will be scaled to the output range set by the Output range min and the Output range max settings. An example use case for this patch would be to let the humidity sensor control the intensity of an EL light. Humidity is a value between 0 – 100, but the intensity of the el lights is set between 0 – 31. To do that you would add a Temperature

/Humidity patch, make a connection between Humidity out and Value in and then from Value out to Light 1 brightness (or any of the other brightness inputs) of the EL driver patch. For this use case the range patch would be set up so that the input range is set to min 0 and max 100 and the output range is set to min 0 and max 31. This means that if the humidity = 100, the output of the range patch would be 31.

Inputs

– Value in

Outputs

– Value out

Settings

– Input range min

– Input range max

– Output range min

– Output range max

Device


Use this patch to control bluetooth advertisement of the A2 and change the system update rate. Bluetooth advertisement is what’s needed for the iPhone/iPad to detect the A2 when it’s disconnected so that it can connect and data can be sent between the devices. It’s a good idea to keep the A2 from advertising as much as possible to save battery lifetime. Send a value of 1/0 for on/off to the input named Advertise On/Off to turn advertisement on/off. The patch also has inputs to control the update rate of the A2’s system. The lower the speed, the greater the battery life. However, you need to make sure that the speed you select is fast enough for the current use case. E.g, if you’re streaming accelerometer data at 13Hz, the update rate must be set to this value or faster.

The advertisement length and advertisement time off settings are used to make the A2 advertise in bursts. E.g, it can be set to advertise for 5 seconds, then rest for 5 seconds. Advertising in bursts can also help increase battery life, but for some use cases the device must always be visible to the phone.

Inputs

– Shutdown – turn of the device.

– Change flow to 13Hz – Set the update rate of the flow of the A2 to 13 Hz.

– Change flow to 26Hz

– Change flow to 52Hz

– Change flow to 1 sec

– Change flow to 2 sec

– Change flow to 5 sec

– Change flow to 10 sec

– Change flow to 20 sec

– Change flow to 30 sec

– Change flow to 60 sec

– Advertise On/Off – Turn on/off bluetooth advertisement. Turning on advertisements makes the device visible to the phone when it’s disconnected. Turning it off saves battery power.

Outputs

– Battery percent out

– Disconnect out – sends a value when the A2 is disconnected from the phone.

– Connect out – sends a value when the A2 is connected from the phone.

– Battery voltage out

Settings

– Advertisement length

– Advertisement time off

EL Driver


Use this patch to control el lights connected to the Neue EL driver. The el driver is connected to the A2 using an FFC cable. There are two options for turning on a light

One way is to enable the el driver in the settings view using the Enable setting and send a value from another patch to any of the brightness inputs. To try it out, you can add a design switch in the design view and connect it to an input of the A2 patch, and in the A2 patch, connect the input to on/off on the EL driver patch.

The other option is to set the intensity of the lights (Light 1 intensity…) in the settings view and control on/off of the el driver by connecting another patch to the on/off or toggle on/off input.

The brightness of each light can be set with a value between 0 – 31. There is also a global color setting that accepts values between 0 – 255, which affects all of the connected lights.

Inputs

– Light 1 brightness (0-31) – 0 is lowest brightness and 31 is the highest brightness.

– Light 2 brightness

– Light 3 brightness

– Light 4 brightness

– Color (0-255) – Sets the color of all 4 lights. When using an el light without any filter on it, 0 will result in a more green color and 255 in a more blue color.

– Toggle on/off – send any value to toggle all the lights on/off.

– On/off – Send 1/0 to turn all the lights on/off.

Outputs

Settings

– Enable

– Light 1 intensity

– Light 2 intensity

– Light 3 intensity

– Light 4 intensity

– Color

Temperature/Humidity


Access the temperature and humidity sensor of the A2. Values are updated and sent every 2 seconds. The humidity value is the relative humidity in percent, so the value goes between 0 – 100, while temperature is in degrees of Celsius.

Inputs

Outputs

– Temp/humidity – sends a list for every sensor update [temperature, humidity]. Use the Split list patch to get unique values in the list, or use one of the outputs below.

– Temperature

– Humidity

Settings

Accelerometer/gyroscope


Use this patch to access the accelerometer – and gyroscope of the A2. Apart from the raw sensor data, the sensor has built in features which are accessed in the Event type setting to detect 6D orientation changes, single/double tap, free fall event and activity/inactivity recognition. One All the output from the events will be sent on the output called Acc event.

The 6D orientation event detects changes in the orientation of the device. Imagine the A2 placed in a dice, whenever the dice switches from one side to another, an event is generated and a value is sent on the Acc event output. Free fall sends a trigger when the sensor detects that it’s falling.

The patch also has inputs for turning on/off the accelerometer and/or gyro.

Inputs

– Accelerometer off

– Gyroscope off

– Gyro 13 Hz

– Gyro 26 Hz

– Gyro 52 Hz

– Acc 13 Hz

– Acc 26 Hz

– Acc 52 Hz

Outputs

– Accelerometer – sends a list of values for every sensor update [x,y,z]. Use the Split list patch to get unique values in the list.

– Gyroscope – sends a list of values for every sensor update [x,y,z]

– Acc/Gyro – sends a list of values for every sensor update [gyro x, gyro y, gyro z, acc x, acc y, acc z]

– Acc event

– Acc vector length

Settings

– Accelerometer scale

– Gyro max degrees per second

– Sensor update rate

– Performance mode

– Event type

A2


An A2 patch represents a unique A2. With the edit tab selected in the Playground app, tapping the + icon at the top right, the A2 patches will be listed under the A2 section with the names of the A2’s you’ve paired. The name of an A2 can be changed in the connect tab.

The A2 has 8 inputs and outputs. It also has 8 log outputs. When connecting a patch to the input of an A2 it means that values are sent to the device (if it’s connected to your phone).

You can send any value to any of the inputs, but string values will be interpreted as the value 0 and decimal numbers will be rounded to the nearest integer.

To configure the A2, tap the white arrow on the A2 patch. In this view, when tapping the + icon at the top right, all the available patches that the A2 provides are listed. When adding a patch in this mode it means that you’re configuring the A2, and the configuration is sent to the device.

To store data on the A2 that can be read when the device is connected to the phone, use the log outputs. On the A2 patch, tap the Tap for additional button and a log out output. Exit this view and enter the config view of the A2 as described above. On the left side of the view, below any of the outputs, you can see the log out output. When connecting any of the A2 patches to this output, it means that the data will be stored on the memory of the A2 and can be read out when the A2 is connected to the phone.

E.g, when in the A2 configuration view, tap the + button at the top right and add a temperature/humidity patch. Tap the Tap for additional button and select temperature in the list. This means that a temperature output was added to the temperature/humidity patch. Connect it to a log out output of the A2 patch. Now temperature values will be stored on the memory of the A2. If you go back one level (by tapping the top left arrow) and connect something to the same log output that you connected the temperature, the log will be read out when the A2 connects to the phone. You can test it by entering the settings view of the A2 patch and disable the Link setting. This will trigger the A2 to disconnect from the phone. Wait 10 seconds and enable Link. The A2 should now connect to the phone and the log should be read out, hopefully containing a few temperature values. You can check the settings view of the patch that you connected the log out output of the A2 to see the values read out from the memory of the A2.

Inputs

– In 1

– In 2

– In 3

– In 4

– In 5

– In 6

– In 7

– In 8

Outputs

– Out 1

– Out 2

– Out 3

– Out 4

– Out 5

– Out 6

– Out 7

– Out 8

– Log out 1

– Log out 2

– Log out 3

– Log out 4

– Log out 5

– Log out 6

– Log out 7

– Log out 8

– Log progress out – a percentage value to see the progress of the reading of the logged data on the A2.

– Connection state out – Whenever the connection state changes, e.g. the device disconnects or connects, values will be sent on this output.

– Signal strength out – the RSSI value of a connected A2.

Settings

– Format log – removes all log data of the A2.

– Link device – With this setting enabled, the phone will always try to connect to this A2, but if it’s disabled, the device will be disconnected.

– Append timestamp to data – Enable this setting to append timestamp to every value received from the A2. This means that every value will be sent as a list, with the timestamp as the last value.

– Append device id to data – Same as timestamp above, but the unique id of this A2.

– Scale gyro to values between -1-1.

– Shut down A2

– A2 system update rate ms – Change how often the A2 runs the flow you’ve configured it to run. Setting it to a higher value will increase battery life but if you want fast readout of the sensors, the value should be low.

Speech synthesis


This patch converts strings sent on Text in to speech, using Apple’s speech synthesis.

Inputs

– Text in

Outputs

Settings

Speech recognition


This patch uses Apple’s speech recognition to convert speech detected with the microphone to text. When the Recognize speech setting is enabled, the microphone of the iOS device is turned on and when speech is recognized it’s sent on the Transcription out output, word for word.

It’s important to keep in mind that if the Playground app is no longer in the foreground (you’ve switched to another app or closed the screen), the speech recognition will stop due to limitations by Apple.

Apple recommends that it should be clearly shown in the UI of the app (flow in the case of Playground) that the microphone is turned on.

Inputs

Outputs

– Transcription out

Settings

– Recognize speech

Update data


Use this patch to update records saved in the Neue cloud for the workspace the flow is in. Each record added to the database gets an id. This is the id that needs to be specified in the setting called Item id. Just like the Save data patch, you send json strings to this patch containing the fields and values to be updated {\”field1\”\”value\”, \”otherField\”3}.

Inputs

– Data in

Outputs

– Error out

– Result out

Settings

– Item id

Save data


Save data in the Neue cloud and the current workspace the flow is in. The patch expects input on Data in as a json string. Use the JSON patch to convert the values you want to save before sending them to this patch. The keys of the JSON blob are the fields and the value is the value of that field. An example JSON blob could be {‘type’ = ‘myuser’, ‘username’=’firstuser’, userage=’25’} You can create a list using the list builder patch and save the data in a batch. Continuing on the first example it would look like [{‘type’ = ‘myuser’, ‘username’=’firstuser’, userage=’25’},{‘type’ = ‘myuser’, ‘username’=’seconduser’, userage=’32’}].

The output called Result out will send the value 1 if the data was successfully stored in the cloud storage and 0 if an error occurred. The output named Error out will send a text message of any error has occured, either when trying to convert the data or saving it to the cloud.

Inputs

– Data in

Outputs

– Result out

– Error out

Settings

Remove data


Use this patch to delete records saved in the Neue cloud for the current workspace. Each record added to the database gets a unique id. This is the id that needs to be specified in the setting called Item id. When you fetch data using the Fetch data patch, you will get the id of each item that’s fetched.

Inputs

– Trigger remove data in

Outputs

– Result out – Sends 1 or 0, depending on if the record was successfully deleted or not.

– Error out

Settings

– Item id

Fetch data


Use this patch to read data stored in the Neue cloud in the current workspace you’re in. To specify what data you’re looking for, you configure a query in the Query string settings. A query is specified as fieldvalue. Perhaps you’re looking for all the users of a game in the current flow you’ve created where you’ve already saved data using the Save data patch with data containing a field called mytype with the value userdata. To fetch that data you’d set the Query string to mytype”userdata”. If any data exists in the cloud you’d get all the values sent on the Result out output. The result is sent in JSON format and for this you need to use the Convert from JSON patch to fetch the values of the fields. Continuing on the above example, say that you’ve saved data as follows
mytype”userdata”, name “Bob”, age 34
mytype”userdata”, name “Jane”, age 42

Inputs

– Trigger search in

Outputs

– Result out

– Did find results out – sends the value 1 if any results for the search was found.

– Error out

Settings

– Query string

– Page nr

– Max nr of results

Reaction game engine


Use this patch as the engine to create a simple reaction time game. A game is started when any value is received on the Play in input. Values are sent on the outputs named Device X out X. After that, the patch waits for input on any of the Device in X hit in inputs. The values sent on the device outputs are 1 or 0, which can be connected to an LED of an A2 e.g, to signal to the user which device to hit.

The game could either be in countdown mode where the game will stop when countdown has reached 0, or it simply counts up and will stop when the command list is finished, or an input is received on Reset in. The time count mode is set by the Time count mode setting.

There are 2 options to create a game, which is set by Device select mode.

When selecting List, you configure which outputs should send values in what order in the Command list setting. The other option is to use the Random option, which basically creates a game session where values are sent on randomly selected device outputs.

To use the List option you type the commands to control the game, in a list separated by commas (,). The commands are written as commandparameter. The available commands are
– 1,2,3,4. These represent one of the 4 device outputs. To select if it should be output 1 or 2, the device number command is followed by a colon and the parameter 1 or 2. E.g, you want the next command to trigger output 1 on device 2, the command to write is 21.

– D means delay, followed by the delay time in milliseconds. So D1000 would perform a delay of 1 sec.

– R means repeating all previous commands up until now followed by the number of times to repeat it. R3 would repeat all previous commands 3 times.

An example game setup could be
11,D1000,22,D1000,12,D1000,21,D2000,R3.

This would result in the following actions
1 is sent on Device 1 out 1.The patch will either wait until it receives an input on any of the Device X hit in inputs, or the time set in Time to hit next has passed. Next, the patch sends the value 0 on all outputs in order to turn off whatever is used to signal to the user, such as an LED on an A2. Now the game performs a delay for 1 second since the next command is D1000.

Next, the value 1 is sent on Device 2 out 2 and the patch is now in wait mode as described for the first command. Next a delay will occur. After that, 1 on Device 1 out 2, wait mode, delay for one second, 1 on Device 2 out 1. And at last is a repeat command, so all of the above will be repeated 3 times until the game is finished.

During the game, stats and time is sent on the outputs as described in the outputs section.

Inputs

– Play in

– Pause in

– Reset in

– Device 1 hit in

– Device 2 hit in

– Device 3 hit in

– Device 4 hit in

Outputs

– Avg response time out

– Last response time out

– Nr of correct hits out

– Nr of missed hits out

– Time string out – Sends a string with the elapsed time or time left in the format minutesseconds, to be displayed in the UI.

– Seconds out – As above but instead it sends the elapsed time or time left, as a numeric value in seconds.

– Game finished out

– Device 1 out 1

– Device 1 out 2

– Device 2 out 1

– Device 2 out 2

– Device 3 out 1

– Device 3 out 2

– Device 4 out 1

– Device 4 out 2

Settings

Settings

– Device select mode – Choose whether to use the commands configured in the Command list setting, or just create random commands.

– Command list

– Time count mode

– Count down time – This is used when Time count mode is set to Count down and stop. Here you configure the total game time.

– Stop at nr of hits – Enables the mode where the game stops after a number of hits set in the Nr of hits stop at setting . A hit is any value received on any of the Device 1 hit in inputs.

– Nr of hits stop at – this specifies the number of hits for the Stop at nr of hits setting.

– Time to hit next – The maximum time (in seconds) the patch waits between a value is sent on any of the Device X out X outputs until it receives any value on any of the Device X hit in inputs. If no input is received, it’s counted as a miss.

Button


When tapping the settings button of this patch, a value is sent on Trigger out.

This is a simple patch that can be used when building a flow and debugging it, to quickly generate a trigger for another patch.

Inputs

Outputs

– Trigger out

Settings

String/Number


When receiving a trigger on the Trigger in input, the string or number entered in the String or number setting will be sent on the output. To make sure that the patch that receives the data from the String/Number patch interprets it as the intended type, the type can be specified in the Type setting.

Inputs

– Trigger in

Outputs

– String/Number out

Settings

– String or number

– Type

Waveform/random


Will generate a signal in the range of 0 to 1 for a selected function in the given frequency when the Enable setting is enabled.. The pulse wave will simply switch between 0 and 1.

Inputs

Outputs

– Signal out

Settings

– Enable

– Signal type

– Frequency

Time


This patch can be used to trigger a timestamp by sending any value to the Trig in input. When triggered, a Unix timestamp is sent on Unix time out, a string in the format specified by the Date format setting is sent on String time out and the value 1 on Trigger out. If you want the String time out output to simply output the time in hours and minutes, you type HHmm in the Date format (yyyy-MM-dd HHmmss) setting. Maybe you want it to send the date in the format 20/01-2021 100000, you enter MM/dd-YYYY HHmmss in the Date format (yyyy-MM-dd HHmmss) setting. The important thing is to keep in mind what the letters represent
Y = year

M = month

d = day

H = hour

m = minute

s = second

A trigger can also be generated by a date, and/or on a specific time, like an alarm. To trigger on a specific date at a specific time, enter the date in the Date YYYYmmdd setting and the time in the Time HHmmss setting. So, to create a trigger on the 3rd of October 2020 at 1015 PM, enter 20201003 in the Date YYYYmmdd setting and 101500 in the Time HHmmss setting.

If no date is set, the trigger will occur the current day at the specified time. If no time is set, and a date is, the trigger will occur at 000000.

A repeat interval in seconds can be specified in the Repeat every x second setting which will make the trigger reoccur after the specified interval has passed. If no date or time is set, the repeat will start instantly. A repeat interval of 0 will turn off the repeated trigger.

Inputs

– Trig in

Outputs

– Unix time out    

– String time out

– Trigger out

Settings

– Date YYYYmmdd

– Time HHmmss

– Repeat every x second

– Date format (yyyy-MM-dd HHmmss)

Group


A group patch is simply a container of patches. It doesn’t have any functionality itself. You use it to better organize your flow. Create several groups of common functionality, instead of having all the patches in one flow.

The inputs and outputs of the group patch are simply ports between patches outside of the patch to patches in the group patch.

You tap the arrow on a group patch in the Edit view, to access the patches inside it.

Inputs

– In 1

– User configurable – add as many inputs as needed by tapping the Tap for additional button on the patch in the Edit view. Give each input a unique name in the settings of the group patch.

Outputs

– Out 1

– User configurable – add as many outputs as needed by tapping the Tap for additional button on the patch in the Edit view. Give each output a unique name in the settings of the group patch.

Settings

Configure the names of inputs and outputs in the settings of this patch, apart from setting the name of the patch.

Navigation


This patch is used to provide turn by turn navigation. It requires start and end geo coordinates to find routes for the selected transportation type. You can use the Location patch to get the user’s current location as geo coordinates, or the Geocoder patch to turn an address to geo coordinates.

After setting the start and end geo coordinates in the settings of the patch, send any value to Trigger find routes in to trigger the patch to search for available routes for the transport type selected in the Transport type setting. The available routes will be shown in the Routes setting, and the geo coordinates of the routes are sent as lists on the Route coordinates out output. These coordinates can be used together with the Map view patch to show the routes on a map in the Design view. The Map view patch also allows for the user to select one of the routes shown on the map, which can be sent to the input of the Routes setting. If no route can be found or any other error occurs, a message will be sent on the Error out output.

When a route is selected, navigation will start when the Start navigation setting is enabled. If no route is selected but several routes are found, the one with the shortest duration will be selected.

During navigation as the location of the user changes, the patch sends navigation instructions on the outputs of the patch. The complete description of upcoming and current maneuvers are sent on the outputs Upcoming description out and Maneuver description out. The patch also signals on the right and left outputs (Any left out, Left out, Sharp… etc), so that the navigation instructions can trigger e.g a light or a haptic feedback motor. For any left turn (left/sharp/slight) a value is sent on Any left out, and the same goes for right turns and Any right out.

The patch requires that the user has authorized the Playground app to get access to the user’s location.

Inputs

– Trigger find routes in

Outputs

– Any right out

– Any left out

– Left out

– Sharp left out

– Slight left out

– Right out

– Sharp right out

– Slight right out

– Straight ahead out

– U-turn out

– Maneuver description out

– Upcoming description out

– Error out

– Route coordinates out

Settings

– Start navigation

– Routes – will show a list of routes when a successful route search has been triggered

– Start latitude – Latitude of the start position for the route search

– Start longitude – Longitude of the start position for the route search

– End latitude – Latitude of the end position for the route search

– End longitude – Longitude of the end position for the route search

– Transport type

Monitor georegion


Use this patch to detect when a user enters or leaves a geographical region. The region is set up by its coordinate in the Latitude and Longitude setting and the radius in meters configured by the Radius setting.

Inputs

Outputs

Entered region out – sends the value 1 when entering the configured region

Exited region out – sends the value 1 when exiting the configured region

Enter/exit region out – sends the values 1/0 for entering/exiting the configured region.

Settings

Enable monitoring of region

Latitude

Longitude

Radius

Location


Use this patch to get access to location data of the iOS device that the Playground app is running on. Enabling the Enable location updates setting will prompt the user to give the Playground app access to the location of the device, which is needed to access the data of this patch.

Inputs

Outputs

– Latitude out

– Longitude out

– Speed out – in meters per second

– Altitude out – meters above sea level

– Heading out – The heading (measured in degrees) of the iOS device the app is running on, relative to true north.

Settings

– Enable location updates

– Enable heading updates

– Desired location accuracy in meters

– Activity type

Geocoder


Use this patch to convert between geo coordinates (longitude and latitude) to an address or the other way around. Don’t send too many requests too quickly since the service might stop responding.

The Geocode type setting is where you set whether to convert coordinates to an address or the other way around. With Lookup by coordinates selected, you set the longitude and the latitude in the Longitude and Latitude settings. Send any value to Trigger geocode lookup and when the request is completed the address will be sent on the different address output (city, country etc…).

When setting Geocode type to Lookup by address some of the address settings must be set. Sometimes it might be enough with Address 1 (street name and number) and City. But the more fields the more likely that you get the exact destination you’re looking for.

Outputs

– Street address 1 out

– Street address 2 out

– City out

– Country out

– Place name out

– Zip code out

– Error out

– Latitude out

– Longitude out

Settings

– Trigger geocode lookup

– Gecode type

– Latitude

– Longitude

– Address 1

– Address 2

– Zip code

– City

– Country

Philips HUE


Use this patch to control a Philips Hue Light. First you need to select a Philips Hue bridge in the Philips HUE Bridge setting. Make sure that the iOS device you’re running Playground on is on the same wifi network as the bridge. It can take a while (10-20 sec) to find a new bridge so wait until the bridge appears in the list. The Philips Hue bridge may need to authorize the Playground app with the bridge by pushing the button on the bridge. An alert view will be presented to inform about it. After selecting a bridge, select a light in the Philips HUE Light setting.

When everything is set up, you can use all the other settings to turn on/off the selected light or  control its brightness and color.

Inputs

– Light On

– Light Off

Outputs

– Error

Settings

– Philips HUE Bridge

– Philips HUE Light

– LightList

– Toggle light

– Brightness

– Hue

– Saturation

– Temperature

– X

– Y

– Red

– Green

– Blue

Spotify


This patch is used to control the Spotify app on one of your devices. A Spotify premium account is required for this patch to be able to access Spotify.

To play a track on Spotify you first have to find the URI of the album or playlist it’s on. This can be done using the Spotify desktop app. Type the URI in the setting called URI (album, playlist or artist). You can select the track number of the album or playlist by setting the Offset (track number, 0 = first) setting. Next, tap Play in the settings view, or connect anything to the Play input. If needed, a login flow for Spotify will be shown in a web view. After logging in to your account, the track should start playing.

The Device setting is used to select which device the patch controls. It can either be selected in the settings view directly, or you can add a list view patch to the design view and connect Device list out to it to show the available devices. You need to trigger the patch to search for devices and this is done by sending any value to the Search for devices input. The list view patch selected index output should be connected to the input called Device.

The volume can be set to a value between 0 – 1.0. You can control it in the settings view with the Volume setting, or by connecting something to the Volume input. You can also connect something to Volume change in. When sending something to Volume change in, the current volume will be increased by the incoming value. If the current volume is 0.5 and Volume change in receives a value of 0.2, the volume will be set to 0.5 + 0.2 = 0.7.

When changing to a different device, the patch will fetch the current volume of the new device and the value will be sent on Volume out.

Inputs

– Next in

– Previous in

– Uri in

– Volume change in

– Search for devices.

Outputs

– Device list out

– Error out

– Volume out

Settings

– Authorize Spotify

– URI (album, playlist or artist)

– Offset (track number, 0 = first)

– Play

– Stop

– Volume

– Device

QR Code reader


Send a value to the Trigger read input to show a camera view so that the user can scan a QR code. When a code is successfully scanned, the code will be sent on Code out.

Inputs

– Trigger read

Outputs

– Code out

Settings

NFC Tag reader


Send a value to the Trigger read input to show an NFC reader view that prompts the user to hold the iOS device near an NFC patch to read it. If a tag is read, the payload will be sent on Payload out and a unique identifier of the record on Identifier out. Since NFC is not available on all devices, an error will be sent out on Error out if NFC is not available on the current device. An error out message will also be sent when the iOS scan view is dismissed by the user.

The patch currently supports tags containing text or URI payloads. If the payload is of any other type, no data will be sent.

Inputs

– Trigger read

Outputs

– Payload out

– Identifier out

– Error out

Settings

User info


Use this patch to retrieve information about the Playground account currently logged in the iOS device running the flow. Send any value to Trigger read and information will be sent on the different outputs.

Inputs

– Trigger read

Outputs

– Username out

– User email out

– User id out

Settings

Trigger


This patch will send the value received on Trigger in on Value out once and then blocks all incoming values until it’s reset. You reset the patch by sending any value to Reset in or by setting Reset delay. Reset delay is in milliseconds and means that after having received any value on Trigger in, the patch will be reset when the Reset delay time has passed.

By setting the Trigger delay setting (in milliseconds), the value received on Trigger in will be sent on Value out when the delay time has passed since receiving the value on Trigger in.

A typical scenario for this patch is when working with sensor data. Let’s say you want to trigger something using data from the accelerometer of the A2. So, when the accelerometer value is greater than a threshold value, you want it to send a trigger to something else. In order for it not to keep sending these triggers when the accelerometer value is above the threshold, you can use this patch. When the accelerometer value is below the threshold, the trigger patch will be reset so that it can trigger again. In a scenario like that it can be useful to add a reset delay, since the accelerometer value can flicker a bit above and below the threshold value when being close to it.

Inputs

– Trigger in

– Reset in

Outputs

– Value out

– Digital out

Settings

– Trigger delay

– Reset delay

Timer


The timer is started by tapping the Start timer in the settings view, or by adding the Start timer input and sending any value to it. Add it by tapping Tap for additional on the patch in the Edit view. When a trigger is received to start the timer, the patch waits for the period set by the Timer period in ms setting until it sends a value on Timer fire out.

The last value received on Start timer will be sent on Timer fire out. When triggered in the settings view, the patch will send the value 1 on Timer fire out, when the timer period has passed.

If Repeat timer is enabled, the patch will simply redo the above with waiting and sending until the timer is stopped by triggering the Stop timer setting, either manually in the settings view or by sending any value to the Stop timer input.

If Restart active timer on start is selected, the timer will be restarted when a trigger is received on Start timer. As long as it’s restarted before the period has passed since the last trigger of Start timer, the timer won’t fire and no value will be sent on Timer fire out. You can think of it as a way of checking for inactivity. By setting the period to 3000 and enabling Restart active timer on start, whatever is connected to Start timer must have been stopped for 3 seconds until the timer fires and a value is sent on Timer fire out.

If Restart active timer on start is not enabled, nothing will happen when the timer is started when receiving a trigger to start the timer. Instead a new timer can be started when the current has timed out, or a stop timer trigger has been received.

Inputs

Outputs

– Timer fire out

Settings

– Stop timer

– Start timer

– Restart active timer on start

– Timer period in ms

– Repeat timer

Switch


The switch can have as many inputs as you like, but only values from one input will pass through on Switch out. You select which input is open in the Selected input setting.

Inputs

Dynamic – created by the user by tapping Tap for additional on the patch and in the view that appears tap Add Switch input.

Outputs

Switch out

Settings

Selected input

String operations


When a value is received on String in, the selected Operation will be performed on the new value using Argument and/or Replace with. The result of the operation is sent on String out. The operation called append will append the string typed into the Argument setting on all incoming values. So, if the value received on String in is “hello ” and Argument is set to “there ”, “hello there” will be sent on String out.

The prepend operation will add the string in the Argument setting before the incoming string. So, in the above example the result sent on String out would be “there hello ”.

The remove operation will remove the string in the Argument setting from the incoming values, if found there. So, if the value received on String in is the string “A cat” and Argument is set to “cat”, “A “ would be the resulting string sent on String out.

The replace operation looks at the string in the Argument setting and if found in any value received on String in replaces it with the string in the Replace with setting. So, let’s say that Argument is set to “cat” and Replace with is set to “dog”. If “A cat” is received on String in, the resulting string sent on String out would be “A dog”.

Finally, To upper case and To lower case will simply switch the strings on all incoming values to the selected case. So, if “A cat” is received on String in and the Operation setting is To upper case, the resulting string sent on String out would be “A CAT”, and with To lower case it would be “a cat”.

Inputs

– String in

Outputs

– String out

Settings

– Operation

– Argument

– Replace with

Stepper


When receiving a new value on Value in, this patch rounds it to the nearest integer and looks at the previous value sent on Step out. If the difference between the new rounded value and the previously sent value is greater than (+-) Stepsize, the patch sends the new rounded value on Step out.

A use case for this is when sending values to the A2. E.g, you want to use the Waveform/random patch to let a sine wave control the brightness of an EL light. The Waveform/random patch generates values between 0 – 1. So first, you’d have to scale them to the 0 – 31 range since that’s the range to control the brightness of an EL light. You could use a Range patch or a Math patch to do that. However, you only want to send integer values to the A2, and to achieve that you can use this patch, so that only the integer values in the range 0 – 31 will be sent, not 0.1, 0.2, 0.3 etc.

Inputs

– Value in

Outputs

– Step out

Settings

– Stepsize

State


Use this patch to simply store a value while a flow is running. You can either type in that value in the State setting, or send a value to the State input. If you type in the value, it will be stored between the sessions. So when changing to another flow and going back to this one, that setting will be stored.

Send any value to Send state to send the value kept by the patch on State out.

Inputs

– Send state

Outputs

– State out

Settings

– State

Split list


This patch is used to cut out a part of a list. E.g, if you’re working with accelerometer data from the A2 which is sent as a list [x,y,z], but you’re only interested in the z value, this is the patch to use to remove the x and y values from the list.

The part of the list that should be sent on Result out is defined by the Split start and Split end settings. If the incoming list on List in is [10,11,12], setting Split start to 1 and Split end to 2, will result in the list [10,11] being sent on Result out. If instead Split start and Split end both are set to 1, only the first value in the list – 10 – will be sent on Result out.

If Split start is below 1, it will automatically default to 1. If Split start is greater than Split endSplit start will be set to Split end.

Inputs

– List in

Outputs

– Result out

Settings

– Split start

– Split end

Range


Use this patch to convert values between different ranges. Let’s say you want to use humidity values of the A2 which is in the range 0 – 100 to control the blue color of a text label in the design view which is in the range 0 – 255, you can use this patch.

If the incoming value is in the range defined by the Min input value

setting to the Max input value setting, it will be scaled to the output range defined by the Min output value and Max output value settings.

E.g, if the input range is 0 – 100, the output range 0 – 1, an incoming value on Range in of 50 will be scaled to 0.5. If a list is received on the input, the first value of that list will be used. Enabling Use input to find min/max will let the incoming value update Max input value if the incoming value is smaller than the current value or if the incoming value is greater than Max input value, it will be updated to the new incoming value.

Enabling the Clamp setting means that if a value is lower than Mix input value, it will be treated as the min value and the same goes for values above Max input value.

If an incoming value is in the specified input range the value 1 will be sent on Digital out, if it’s not in range, the value 0 will be sent on this output.


This patch can be used for a lot of different use cases, like in the example above, you want to use the humidity sensor of the A2 to control the blue color of a text label in the Design view. Humidity is in the range 0  – 100 and the blue color in the range 0 – 255. For that you would set the Min input value to 0, Max input value to 100, Min output value to 0 and Max output value to 255. Or maybe set the input range more narrow, since humidity values of 0 and 100 are more rare, you could set the input range to 30 – 80 to see the change of the blue color more clearly.

Inputs

– Range in

Outputs

– Range out

– Digital out

Settings

– Min input value

– Max input value

– Min output value

– Max output value

– Clamp

Orientation (Kalman filter)


Use this patch to get the orientation of the A2 represented as a list of euler angles or a quaternion. It’s important to keep in mind that the gyro of the A2 is not calibrated, so you need to use the Calibrate patch before this patch to get correct gyro data for this patch to work properly. Since the orientation is calculated using only 2 sensors (acc/gyro), the filter needs to be reset after a short period of time which is done by tapping the Reset filter setting or sending any value to the input of that setting.

A typical use case is to connect this patch to the 3D view patch to use the A2 as a controller to rotate a 3D model.

Inputs

– Acc/gyro in – expects the incoming value to be a list [gyro x, gyro y, gyro z, acc x, acc y, acc z] – which is the order it’s sent from the A2.

Outputs

– Euler angles out – outputs a list [x,y,z]

– Quaternion out – outputs a list [q1,q2,q3,q4]

Settings

– Reset filter

Number to string


Use this patch to get a desired formatting of numbers.

The numeric value received on Number in will be formatted according to the settings and a value will be sent on String out containing the original number but the string of that value will be the formatted string representation of the incoming value.

If you want each value to be formatted as xxpxx, you’d set the Min nr of integer digits setting to 2 (and Max nr of integer digits setting to 2 if you explicitly want to show only 2 integer digits). The same goes for the decimal digits. In this case the Decimal separator setting is set to p. If the patch would receive the value 1.1 on Value in, the result would be 01p10 with the above settings.

Inputs

– Number in

Outputs

– String out

Settings

– Min nr of decimal digits

– Max nr of decimal digits

– Min nr of integer digits

– Max nr of integer digits

– Decimal separator

Math


When a value is received on Math in a math operation will be performed using the incoming value and the value set in the Operand setting and the result will be sent on Result out. The Math operator setting is used to select the type of math operation to be performed. Currently addition, subtraction, multiplication, division and modulus are supported.

For subtraction, division and modulus the order of the operation is as follows

Operand – Math in. If the Operand is set to 2 and 1 is received on Math in the math operation is 2 – 1 and thus the resulting value 1 is sent on Result out.

Math in / Operand. If the Operand is set to 2 and 1 is received on Math in the math operation is 1 / 2 and thus the resulting value 0,5 is sent on Result out.

Math in % Operand. If the Operand is set to 2 and 4 is received on Math in the math operation is 4 % 2 and thus the resulting value 0 is sent on Result out.

Inputs

– Math in

Outputs

– Result out

Settings

– Math operator

– Operand

List builder


This patch builds a list from single values sent to it on the input called Value in. If a list is sent to that input, it will take each element and add to the list it’s keeping. The list will be sent from the patch when the number of elements equals the value in the setting called Max number of elements or when receiving a trigger on the input Send and reset. It will send the complete list on List out, and each value separately on Values out.

The patch will send data about its list on separate outputs whenever it receives a new value on Value in

Min out will send the lowest number in the list.

Max out will send the highest number in the list.

Sum out will send the sum of the numbers in the list.

Avg out will send the average value of all the numbers in the list

Count out will send the number of elements in the list.

Vector length out will send the length of the vector created by the numbers. This means the root of the sum of all the numbers squared.

The max size of a list is 10000.

Inputs

– Value in

– Send and reset

– Delete list

– Send value at index – when a number is received on this input the patch will send the value from its list at the position of the number on Values out. So, if the value 3 is received, the third value in the list will be sent on Values out.

– Pop last in – When any value is received on this input the last value of the list will be sent on Values out and removed from the list.

Outputs

– List out

– Avg out

– Min out

– Max out

– Vector length out

– Count out

– Sum out

– Values out

Settings

– Max number of elements

Funnel


In Playground, it’s not possible to make several connections to one input and to solve this problem you can use this patch. Create as many inputs as you need and whatever is sent on any of those inputs will be sent on the Funnel out output.

An example use case could be a text label in the Design view that can display different messages depending on an A2 being connected or not. If it’s connected to the iOS device the label should show the text “The device is connected”. If it’s not connected it should show “The device is not connected”. For these two messages, you could have two String patches, one for each message, and then connect the output of each String patch to an input of a Funnel patch. The output of the Funnel patch is connected to the Title input of the Text label patch.

Inputs

Dynamic – created by the user by tapping Tap for additional on the patch and in the view that appears tap Add Funnel input.

Outputs

– Funnel out

Settings

Flow start/stop


A value will be sent on Flow did start out when the current flow is started and on Flow will stop out right before it’s stopped. Currently, a flow is stopped when the user starts another flow.

Inputs

Outputs

– Flow did start out

– Flow will stop out

Settings

Flag


When the patch receives any value on the input named Flag in it will set an internal flag. When that flag is set, the next value received on Flag in will pass through and sent on Value out and the flag will now be unset. The next value received on Flag in will again set the flag, but that value will not be sent on Value out.

The Digital out will send the value of the internal flag, thus toggling between 1/0.

A typical use case for this page is to use the toggling feature when using the Digital out output.

Inputs

– Flag in

Outputs

– Value out

– Digital out

Settings

Debug


This patch will simply show the last message it has received. Any messages sent to it will simply be sent through on the output.

Inputs

– Debug in

Outputs

– Debug out

Settings

Compare


This patch is used to filter incoming values for when a certain condition is met, or is not met. Say that you want to create a notification using the iOS Notification patch when the temperature measured by the A2 rises above 25°C, then this is the patch to use to perform the check of each temperature value.

To use it, start by tapping Tap for additional on the patch and select Add compare input in the view that appears. This creates an input called Compare in 1. This is where you will connect whatever it is you want to compare. Next, tap the settings view and select the type of comparison you want to do by tapping the setting called is. And finally type the condition value in the setting called Condition value. In the example above, you’d set the is setting to > or >= for greater than or greater than or equal to, and the Condition value setting to 25.

For every incoming value, the patch will now check if it’s greater than 25 (or >= if that’s what you’ve selected).

If the patch receives a value greater than 25, let’s use 26 as an example, the following values will be sent on the outputs of the patch

Value out – sends the current value that the patched received 26.

Digital out – sends 1, since the comparison is true.

Else out – sends no value

Else value out – sends no value

If the value is below 25, let’s use 24 as an example, i.e the comparison is false, the following values will be sent on the outputs of the patch

Value out – sends no value

Digital out – sends 0, since the comparison is false.

Else out – sends the value 1

Else value out – sends the current value that the patched received 24.

In the example above you can see that you can perform triggers both depending on the comparison being true or not, by using the digital outelse out and else value out outputs.

The digital out can be useful when wanting to control on/off of something else. Say that you want to control playback of Spotify, or on/off of a Philips Hue light, so that if the temperature value is greater than 25, the light should be turned on, and below 25 the light should be turned off, you can configure the compare patch as in the example above and use the digital out output.


You can also use the patch to compare strings, but for that only the = or != of the is setting can be used.

Inputs

– Dynamic – created by the user by tapping Tap for additional on the patch and in the view that appears tap Add compare input.

Outputs

– Value out – Sends the value that the patch received on any of the compare inputs, if the comparison is true.

– Digital out – Sends the value 1 if a comparison is true, otherwise 0.

– Else out – Sends the value 0 if a comparison is false.

– Else value out – Sends the value that the patch received on any of the compare inputs, if the comparison is false.

Settings

– If value on

– is

– Condition value

Calibrate gyro


Gyro data from the A2 is not calibrated, so each value has an offset. When the A2 is completely still and no rotation is detected, the gyro values should be [0,0,0].When Trigger calibrate is tapped (in the settings view of the patch) or triggered (when receiving any value on the input that the setting generates), it samples incoming gyro values for a few seconds and uses it to calculate the offset. Then it applies this offset to each incoming gyro value and sends the processed gyro data list on Processed out. In order for the patch to calculate this offset, it’s important that the A2 is completely still during the calibration.

When the calibration is finished, the patch sends the value 1 on Calibration finished out, which can be used to show in the Design view that the calibration is finished.

The patch looks at the three first values in the incoming list (and will not process the data if the list has less than 3 values), and applies the offset to these 3 values. That means that you can connect the Acc/Gyro output of the A2’s Accelerometer/Gyroscope patch and only the gyroscope values will be processed.

Inputs

– Gyro list in

Outputs

– Processed out

– Calibration finished out

Settings

– Trigger calibrate

– X_offset

– Y_offset

– Z_offset

Working with JSON


When using the web patches you’ll often come across the need to use JSON as a way to format data for sending and retrieving between the Playground app to a web service, an MQTT topic or something else. Let’s say that you want to send temperature and humidity data to a web service, to display it in a graph on the web. Instead of just sending a list of the two values [25,40], JSON labels the values to make it easier to read the data on the receiving side. So, the above formatted as a JSON object could look like

{

 “temperature”25,

 “humidity”40

}

As you can see, it gets more readable and clear. JSON objects can be much more complex and contain nested JSON objects or lists of JSON objects.

It’s important to check that the syntax is correct, since there are a few rules to follow in order for it to be valid JSON. A JSON object always starts with { and ends with }.

If you’re unfamiliar to JSON, it’s recommended to simply look up these rules on the web.

Websocket


Will try to open a websocket on the url specified in the Websocket path setting. Remember to add the full path including the ws//, wss//, http// or https// prefix. Finally, enable the Open websocket setting to connect to the websocket. If the patch is able to connect you should see a status message below the settings of the patch.

When the socket is open you can send any value to Send message to send it on the socket. If a message is received it will be sent on Message out.

When the socket opens or closes, status messages will be sent on Socket state out.

Inputs

– Send message

Outputs

– Message out

– Socket state out

Settings

– Websocket path

– Open websocket

OAuth 1.0


Use this patch to authorize a web service that uses OAuth 1.0. The authorization flow is triggered when receiving any value on Authorize trigger.

If the authorization is successful, select the name of this OAUth patch in an HTTP patch that makes requests to the resource this OAuth patch provides authorization info for.

Inputs

– Authorize trigger

Outputs

– Success out

– Error out

Settings

– Consumer key

– Consumer secret

– Access token URL

– Authorize URL

– Request token URL

– Token

– Token secret

– Authorize

MQTT


Publish and subscribe to an MQTT broker for a given topic. Set the URL of the broker in the Host setting, without prefixing it with mqtt//. Remember to set a client id in the Client ID setting, and if several MQTT patches are used in the same flow, the client id needs to be different for each patch that connects to the same broker.

When everything (at least Host, Port and Client ID) is configured, enable the Connect setting. If the connection to the broker is successful, you should see a message under Status below the settings of the patch. Status messages will also be sent on Status out.

To publish a message with a topic (set by the Topic setting), just send any value you want to publish to Publish msg in.

In order to subscribe to the topic set by the Topic setting, just enable the Subscribe setting. When a message is received, it’s sent on MQTT msg out.

Inputs

– Publish msg in

– Ping in

Outputs

– MQTT msg out

– MQTT pong out

– Error out

– Status out

Settings

– Topic

– Client ID

– Username    

– Password

– Port

– Host

– Connect

– Subscribe

– UseSSL

HTTP


Use this patch to perform HTTP requests. The request will be performed when receiving any value on Perform request. Depending on the resource you’re accessing and the method, you might want to pass in parameters as a query string or as json. For this there is either the Query string setting or the Parameters as JSON setting.

If you want to specify custom HTTP headers, use the HTTP Headers setting. Type in each header key and value separated by a colon, and each pair separated by comma:header1:value,header2:value.

The response of the HTTP request will be sent on Response out. The status code will be sent on Status out. If an error occurs, it will be sent on Error out.

The patch supports both basic authentication and OAuth 1. For OAuth 1, you need to add an OAuth 1 patch to your flow and configure it as needed. Then it will be visible in the OAuth 1 setting so that it can be selected.

Inputs

– Request trigger

Outputs

– Response out

– Status out

– Error out

Settings

– URL

– Query string

– Parameters as JSON

– HTTP Method

– HTTP Headers

– OAuth 1

– Basic auth id

– Basic auth password

– Perform request

Convert from JSON / Parse JSON


If you’re unfamiliar with JSON, read here.

Use this patch to read values in a JSON object. Previously we’ve used the example of temperature and humidity data formatted as a simple JSON object

{

 “temperature”25,

 “humidity”40

}

In order to extract the 25 and 40, you can use this patch.

When the patch receives a value on JSON in, it will first check if it’s a valid JSON object. Next, it will check the settings of the patch. If anything is typed into the Key setting, the patch will look for that key, or label in the JSON object and send the value of it on Parsed out. If temperature would be the Key, then if the patch would receive the above example JSON object, it would send 25 on Parsed out. In order to extract both values, you’d need two of these patches, one for each key.

Sometimes a JSON object is more complex than the above. It can contain nested JSON objects

{

  “climate” {

“temperature”25,

  “humidity”40

}

}

In the above example we have a root object that contains a nested object with the key climate. In order to extract the temperature value from this JSON object, you can set the Key setting to climate.temperature. You use dots to directly access nested objects.

Another option in the above would be to connect two of these patches together. The first one with Key set to climate, resulting in the below sent on Parsed out

{

 “temperature”25,

  “humidity”40

}.

The second patch would then parse out the temperature (or humidity) value, by setting Key to temperature (or humidity).


The Condition setting is used to set a condition for the value. So if the value found for the given Key is equal to Condition, the value will be sent on Parsed out. This can be useful when working with more complex JSON data and you want to filter out some data from a JSON object for further processing.

Inputs

– JSON in

Outputs

– Parsed out

Settings

– Key

– Condition

Convert to JSON / JSON Creator


If you’re unfamiliar with JSON, read here.

Use this patch to create a template for a JSON object. Values sent on the inputs will replace placeholders in the template and trigger the patch to send a JSON object as a string on JSON out. You create the placeholders by typing (IN[input number]) in the template text, where [input number] is replaced with the number of the input.

Here’s a simple example template

{“temperature”(IN1), “humidity”(IN2)}
For this to work, two inputs must be added to the patch with temperature values connected to input 1 and humidity values connected to input 2.

If several inputs are added, the patch will wait until having received data on all inputs before creating the json string and sending it on JSON out.

Make sure to use quotation marks around all string values in your JSON template, like “text”. Unfortunately, on some iOS keyboards, tapping the “-button will create a “-sign that’s not valid JSON. Hold down the “-button on your iOS-keyboard to see a list of different quotation marks and select the one that’s made of straight lines, like this .

Unlike the String operations patch, this patch makes sure that the string created is a valid JSON object.

If the patch fails to create a JSON object from the template, you will see a status message above the message log on the settings page of the patch.

Inputs

Dynamic – created by the user by tapping Tap for additional on the patch and in the view that appears tap Add JSON Creator input.

Outputs

– JSON out

Settings

– Json Template

iOS Pedometer


Get pedometer updates from the iOS device the app is running on.

Inputs

Outputs

 Average active pace – The average pace of the user, measured in seconds per meter.

– Current pace – The current pace of the user, measured in seconds per meter.

– Current cadence – The rate at which steps are taken, measured in steps per second.

– Floors ascended – The approximate number of floors ascended by walking.

– Floors descended – The approximate number of floors descended by walking.

– Step count out – Number of steps since the pedometer updates were enabled.

– Distance out – The estimated distance (in meters) traveled by the user since the pedometer updates were enabled.

Settings

– Enable pedometer updates

iOS Motion and altitude


Access motion sensor data from the iOS device the app is running on. Check the above documentation for each output.

Inputs

Outputs

– Attitude euler out – attitude is the current orientation of the device, or the pitch, roll and yaw. Outputs a list [roll,pitch,yaw].

– Attitude quaternion out – attitude expressed as a quaternion. Outputs a list [qX,qY,qZ,qW].

– Gravity out – The total acceleration of the device is equal to gravity plus the acceleration the user imparts to the device. Outputs a list [x,y,z].

– Magnetic field out – Returns the magnetic field vector with respect to the device, outputs a list [x,y,z, accuracy]

– User acceleration out – The total acceleration of the device is equal to gravity (above) plus the acceleration the user imparts to the device. Outputs a list [x,y,z]

– Rotation rate out – The rotation rate of the iOS device [x,y,z].

– Relative altitude out – When the Enable relative altitude updates setting is enabled, the value is 0 and will then change when the measured altitude of the device changes. So, if the altitude of the device is 5 meter above the first altitude value, the value sent on the output will be 5. The value is in meters.

– Pressure out – Raw data from the pressure sensor.

– Heading out – The heading of the device, 0 – 360°.

Settings

– Enable motion updates

– Enable relative altitude updates

– Motion update interval (sec)

iOS Motion activity


Access motion activity data that this iPhone can generate using its sensors. When one of the activity types in the output list is detected, a value is sent on that output. For each activity type detected there is also a confidence value specifying how sure the algorithm is that the detected motion activity type is accurate.

Inputs

Outputs

– Walking out

– Stationary out

– Running out

– Cycling out

– Unknown out

– Automotive out

– Confidence out

Settings

– Enable motion activity updates

iOS Notification


When any value is sent to Trigger notification in, an iOS notification will be created with the title and message specified in the settings. To actually see the notification you need to either have another app in the foreground or the phone in inactive mode.

Inputs

– Trigger notification in

Outputs

Settings

– Notification title

– Notification message

– Sound

Vibrate


Will trigger a short vibration on the iOS device you’re running this app on when receiving any value on Vibrate trig in.

Inputs

– Vibrate trig in

Outputs

Settings

Design page


This patch represents the user interface of the flow that you see in the Design tab of the Playground app, and works like a group patch. You can add patches to the design page either when inside this patch, or by tapping the + button in the design page. Most patches, like button, slider, switch etc are rendered as that component in the design page. You can change the settings of these patches/components in the same way you change the settings of any patch, or access them from the design page by tapping the eye icon, then the component you wish to change, and then the blue edit button at the bottom left of the screen..

Inputs

– In 1

– User configurable – add as many inputs as needed by tapping the Tap for additional button on the patch in the Edit view. Give each input a unique name in the settings of the group patch.

Outputs

– Out 1

– User configurable – add as many outputs as needed by tapping the Tap for additional button on the patch in the Edit view. Give each output a unique name in the settings of the group patch.

Settings

Configure the names of inputs and outputs in the settings of this patch, apart from setting the name of the patch.

Background gradient


Creates a background gradient in the design view, between the 2 colors.

Inputs

Outputs

Settings

– Color red

– Color green

– Color blue

– Second color red

– Second color green

– Second color blue

– Image

Background color


Changes the background color of the design view or sets the selected image as the background.

Inputs

Outputs

Settings

– Color red

– Color green

– Color blue

– Image

Web view


Creates a web view in the Design view and loads the URL from the URL setting. Make sure to type the full URL (like http//playground.neue.se). Finished loading out will send a value when the web page is loaded and Error out will send a value when an error occurred while loading the web page.

It’s important to keep in mind that if the Playground app is no longer in the foreground (you’ve switched to another app or closed the screen), the speech recognition will stop due to limitations by Apple.

Inputs

Outputs

– Finished loading out

– Error out

Settings

– URL

Standard size and positioning settings described in Working with design components.

Picker view


Creates a picker view in the Design view that can be used to select values in a list. You can either build a list that the picker view shows by sending values one by one on Value in or send a complete list to List in. When sending a list to List in, the current list that the picker view keeps will be replaced. When a new row is selected in the picker view it will send data on its outputs. Selected index out will send the number of the selected row, where the first row is number 0 and Selected value out will send the text shown on the selected row in the picker view.

Inputs

– Value in

– List in

– Delete list

Outputs

– Selected index out

– Selected value out

Settings

– Background color red

– Background color green

– Background color blue

– Background color alpha

– Text color red

– Text color green

– Text color blue

– Text color alpha

Standard size and positioning settings described in Working with design components.

Map view


Creates a map view in the design view, that can be panned, zoomed and rotated. If show user location is enabled the user needs to accept to give Playground access to the phone’s user location data.

Routes can be drawn on the map and each route can be selected, which will trigger a value to be sent on Selected annotation index out. A route is a list of geocoordinate pairs where the first value in a pair is expected to be the latitude and the second the longitude. So a route could look as follows [latitude1,longitude1,latitude2,longitude2….]. If the number of elements in the list is not even, no route will be drawn on the map. When the next list is received, the map view patch will interpret it as the second route to show. To clear all the routes, send any value to Clear routes in.

A typical use case for this is to use it together with the navigation patch to let the user select different routes that the navigation patch can produce when requesting directions from it between 2 coordinates.

You can also use iOS Location patch to get the user’s current geo coordinates and connect Longitude out of the iOS Location patch to the Map center longitude input of the map view and the same for latitude, to let the map stay centered on the user’s position. Just be sure to enable the Enable location update setting of the iOS Location patch.

Inputs

– Clear routes in

– Routes in

Outputs

– Selected annotation index out

Settings

– Map center longitude

– Map center latitude

– Map zoom level

– Show user location

Standard size and positioning settings described in Working with design components.

Design group


This is like a group patch but intended to be used in the design view to be able to to group design elements. If you want to create more complex UI’s where you need to toggle the visibility of several elements, this is the best way to do it. For that, you could connect an input of the group to the visibility input of all the design patches in it.

Inputs

– In 1

– User configurable – add as many inputs as needed by tapping the Tap for additional button on the patch in the Edit view. Give each input a unique name in the settings of the group patch.

Outputs

– Out 1

User configurable – add as many outputs as needed by tapping the Tap for additional button on the patch in the Edit view. Give each output a unique name in the settings of the group patch.

Date picker view


Creates a date picker in the design view. When the picker is changed, data is sent on the outputs. Day, month and year out are sent as integer values. The format of the date string is set by the Date format setting. Year is set by Y, month by M and day by d. So, if you want it to send a string like 30/05-20 when the picker is changed you should set the Date format setting to dd/MM-YY.

Inputs

Outputs

– Date string out

– Day out

– Month out

– Year out

Settings

– Date format

Standard size and positioning settings described in Working with design components.

3D View


Shows a 3D model in the design view that can be rotated by sending values to quaternion in or euler angles in. Currently 2 models can be selected in the 3D model setting.

A typical use case for this is to connect values from the A2 accelerometer and gyroscope to rotate the 3D model using the A2. To do this, add an A2 patch and in that an Accelerometer/Gyroscope patch. Connect the Acc/Gyro output (check Tap for additional if it’s not visible) to any of the A2 outputs at the bottom left. Go back to the root level where the A2 patch is and add a Calibrate gyro patch. Connect the acc/gyro output of the A2 patch to Gyro list in of the Calibrate gyro patch. To calibrate the gyro, enter the settings view of the Calibrate patch and tap Trigger calibrate while holding the A2 completely still.

Next, add a Kalman filter patch and make a connection between the Processed out output of the Calibrate patch to the Acc/gyro in of the Kalman filter patch. The filter normally needs to be reset after a short while, which can be done by entering the settings of the Kalman filter patch and tapping Reset filter. Finally, make a connection between Quaternion out of the Kalman filter to an input of the Design page patch and in that patch (tap the bottom right arrow to enter it), add a 3D view patch and make a connection from the input of the Design page patch to the Quaternion in of the 3D view patch. If everything’s set up correctly, the A2 is connected and acc/gyro values are streaming, you should be able to rotate a 3D model in the Design view.

Inputs

– Quaternion in – Expects a list of 4 values.

– Euler values in – Expects a list of 3 values [x, y, z].

Outputs

Settings

– Quaternion val 1

– Quaternion val 2

– Quaternion val 3

– Quaternion val 4

– Euler x

– Euler y

– Euler z

– Light 1

– Light 2

– 3D model

Standard size and positioning settings described in Working with design components.

Plot


Creates a graph in the design view. Remember to set the expected min and max values for the value you want to display in the graph. When the graph patch receives a value on the value in input, it will be drawn in the graph and the curve is shifted to the left.

Inputs

– Value in

Outputs

Settings

– Min value

– Max value

– Line color

– Line thickness

– Background color

– Nr of points

Standard size and positioning settings described in Working with design components.

Text input


This patch uses Apple’s speech recognition to convert speech detected with the microphone to text. When the Recognize speech setting is enabled, the microphone of the iOS device is turned on and when speech is recognized it’s sent on the Transcription out output, word for word.This patch will create a text field in the Design view. The text entered in the text field in the Design view, can be read out by sending any value to Trigger read text which sends the entered text on Text out. A simple example would be to connect the value out output from a Design button patch to trigger reading the text in the text field.This patch uses Apple’s speech recognition to convert speech detected with the microphone to text. When the Recognize speech setting is enabled, the microphone of the iOS device is turned on and when speech is recognized it’s sent on the Transcription out output, word for word.

Inputs

– Trigger read text

Outputs

– Text out

Settings

– Placeholder

– Width

– Text

– Secret

Standard size and positioning settings described in Working with design components.

Text label


This patch will create a text label in the Design view. The text of the label is set by changing the Title setting. Font size and style can also be changed for the text label.

Inputs

Outputs

Settings

– Title

– Text color red

– Text color green

– Text color blue

– Font size

– Font style

– Text alignment

Standard size and positioning settings described in Working with design components.

Roundable object


This patch will draw a rectangular object in the Design view, accessed from the main menu in the app, with the possibility to round its corners. For an object that has equal height and width value, setting the Rounded corners property to 1.0 it will be drawn as a circle in the Design view.

Inputs

Outputs

Settings

– Background color red

– Background color green

– Background color blue

– Background color alpha

– Border color red

– Border color green

– Border color blue

– Border color alpha

– Rounded corners

– Rotate

– Image

– Content mode

Standard size and positioning settings described in Working with design components.

Design button


This patch will create a button in the Design view. If the Momentary setting is disabled, the button will send the value 1 when tapped in the Design view. If it’s enabled, the button patch will send the value 1 when the button is pressed, and the value 0 when it’s released. The values are sent on the output named Button push out .Check out the docs for the Roundable object patch, for more info about the other settings of this patch.

Inputs

Outputs

Button push out

Settings

Momentary

Title

Title color red

Title color green

Title color blue

Image

Background color red

Background color green

Background color blue

Border color red

Border color green

Border color blue

Content mode

Standard size and positioning settings described in Working with design components.

Design switch


This patch will create a switch in the Design view. When the switch is turned on, the value 1 will be sent on Switch state out, when turned off, the value 0 will be sent on that output.

Inputs

Outputs

Switch state out

Settings

Switch state

Standard size and positioning settings described in Working with design components.

Design slider


This patch will create a slider in the design view. When the slider’s value is changed, its new value will be sent on Slider value out.

Outputs

– Slider value out

Settings

– Min value

– Max value

– Integer values only

– Slider value

Standard size and positioning settings described in Working with design components.

Working with design components


All the design patches for all available UI elements have a set of settings for configuring their size and position. This is done using the following Settings

Top – Set the position of the element related to the top of the view.

Top type – Use percent, point or automatic setting. Percent is a percentage of the screen size. So setting this to 50% would place the top of the element in the middle of the screen.

Point is the exact position in points, where a point is 2 pixels.

For each dimension you need to specify 2 values to either point or percent and the third to automatic.

If you set the top type to automatic, you need to specify both bottom and height to either a percentage or a point value so that the top position can be calculated. Or, if you set the height type to automatic, you need to set the top and bottom types to either percent or point.

And the same goes for left, right and width. Setting left to 5% and right to automatic, means that a width needs to be set either in percent or points.

Left

Left type

Bottom

Bottom type

Right

Right type

Width

Width type

Height

Height type

Z value – If two elements are placed on the same position, the one with the highest z value will be on top.

Vertical alignment

Horizontal alignment

Visible