Arduino sketch

You must use arduino sketch from arduino folder each time when working with Involt. It contains variables and functions used for communication.

Involt sketch automatically updates the values received from app into involtPin array where length is total pin number +1. Undeclared array length may cause some errors in some cases so it's better to have it defined. involtString contains strings. Sometimes it's a good practice to define beginning values in void setup() to make the hardware state consistent to app beginning values (or avoid some bugs).

Keep in mind, as written in previous chapter that you can send more values than your device pin number. You can use more variables to operate inside sketch functions or send values to expanders or shift registers. For example in Arduino UNO, using involtPin index 14-20 to use with shift register. Check Send/receive more... tutorial.

Involt sketch uses only serial library. Everything should work fine as long as you don't try to use software serial. Some devices may need to change Serialto Serial1.

Small delays between multiple send functions are required.

Where did the data received from app go?

The received values are updated to involtPin[pinIndex] array. To use them just write digitalWrite or analogWrite using the desired variable. Button with pin P6 (stored in involt.pin.P[6]) will send value to involtPin[6]. You should keep the index consistent in your project for readability reasons.

...

void loop(){

involtReceive();


analogWrite(6, involtPin[6]);

}

...

The S string pin from app will go to involtString[pinIndex] (S0 will be in involtString[0] and involt.pin.S[0] in app).

For sending 0-1 values for digitalWrite you need to add the pinMode.

Sending the value to app

For sending values use involtSend(pinIndex, value) function. The pinIndex will be same inside app. involtSend(0, analogRead(A0)) can be shown with A0 pin in app (for example: ard show A0).

...

void loop(){

involtReceive();


involtSend(0, analogRead(A0));

delay(2);

}

...

For sending strings use involtSendString(pinIndex, string) function.

...

void loop(){

involtReceive();


involtSendString(10, "involt");

delay(8)

}

...

How to avoid buffer overload

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, you should 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).

How to see the buffer overload? It's simple - it occurs when some numeric values are updated fast and some of them slow (or nothing happens). For strings, it's visible when you get some glitches or the data is updated slowly. It's more problematic on bluetooth and mobile devices.

Changing the bitrate may help. Remember to set it to same value in settings.js