Pins & Arduino sketch

It's very obvious that Arduino pins correlate with Involt pins in app. To understand how to use them we need to distingush the differences between numeric values and text strings. Pins are not only the direct representation of device pins. Treat the Involt pins as a container of values that by sending or receiving are accessible from both sides. In short, there may be more Involt pins than your Arduino hardware pins. They are just variables.

Keeping the Pin-to-Pin relation is most intuitive and highly recommended to maintain readability of your code (A0 analog pin as A0 pin in app). Pin types are P, S and A

Values received from app

Involt can send two types of data. For numeric values Involt uses pins started with P. It's same as in Arduino. They are stored in involtPin array. UI element with P6 will be put into involtPin[6].

When using digitalWrite remember about pinMode. Then you can send value 0 or 1.

analogWrite(6, involtPin[6]);

To send text strings use S pin in your app. The string will be stored in involtString array. S0 will be involtString[0].

if (involtString[0] == "involt"){

analogWrite(6, 255);


Check this by adding two HTML elements to app.html:

<button class="ard button P6 value-50">Number</button>
<button class="ard button S0 value-involt">String</button>

Sending values to app

There are two functions to send your values - involtSend(pin, value) and involtSendString(pin, string). Both numbers and strings are stored as A pin inside app. For example: pin A0 can be number 123 or text word.

Add two show element and check two cases below:

<div class="ard show A0"></div>
<div class="ard show A1"></div>

void loop(){


involtSend(0, analogRead(A0));


involtSendString(1, "involt");




The larger the amount of data is transmitted, or when multiple send functions are in next few lines, the higher the delays between should be. However, consider changes in your project if you're trying to send string in real time like "I really want to update this string to app and show it in real time". It's important especially when sending multiple strings (sometimes 10,20 ms is required).

Probably, at some point you will notice that some things requires to send (or read) data not related to any hardware pin but from i2c/SPI sensor, some calculations or read additional data from multiplexer. In this case just include them as unused pin from pin array. For example: Arduino UNO has 6 analog read pins. If you use multiplexer (or just want to send other values) the additional values can be sent as pins A6-A(n). Or involtPinindex 14-20 to use with shift register (Arduino UNO has only 13 pins).

Remember that undeclared array length may cause some errors in some cases so it's better to have it defined.