Where are the pin values?
It's important to use these arrays and update their values so the framework pin states can be consistent.
involt.pin.P[index] array contains the P pins.
involt.pin.S[index] contains the S strings.
involt.pin.A[index] contains the received values (updated automatically).
Send value to target pin:
Send the function name to device. For triggering function from device to app check functions page.
Send raw string to device. This should be used only with custom arduino sketch.
For better modularity and simplicity of working on existing Involt UI elements use JQuery methods. Framework elements are based on them.
For more examples check the Involt as JQuery plugin.
Changing the UI element parameters
To manipulate the parameters in framework elements use JQuery .data(). These parameters are: pin, pinNumber, pinType, value, min, max, step, fn. While working with HTML inputs use .attr() instead.
Most basic example of assigning the pin to element, updating its value in array and send it to device. You should use this pattern as much as possible. There is one golden rule: using Involt JQuery methods is more about manipulating pins rather than elements that control them.
Currently there are no methods related to receiving data from device. Listening for pin or triggering function is something that reacts to receive event but it's not related to JQuery. The values are updated automatically so use the involt.pin.A[index] if necessary.
Important: remember about JQuery document ready to make sure that everything is loaded.
1. Assigning the pin to element
Defines the pin for selected element (pin, pinNumber, pinType). You don't have to use this method each time, just define this once.
Similar to pinDefine but checks if there is defined pin value in involt.pin arrays. If not - set it to previous pin value. The previous pin must be defined.
2. Updating pin value
Updates the pin current value before sending it to device (involt.pin array). updateValue keeps them up to date so the framework is consistent and multiple UI elements share same single value. Each pin can have only one value at once.
If value is not defined, the pin current value will change to UI element value stored with JQuery data (make sure that the element has .data("value")). If value is set, the pin current value will be same as passed variable to this method.
Define updateElement as true to update both pin value and element value at once.
Before updating the value you must define the pin with pinDefine.
Use the UI element value to update pin value:
Assigned pin now will have new value but not the element itself:
Both UI element and pin will have same new value:
If the pin is defined and its value is set, it's time to send it to device. Passing the value to this method will send the variable to target pin without updating anything.
When everything is defined, send the value:
Send the defined with updateValue value of pin.:
Send the value from element JQuery data ( .data("value", 100)):
Set pin and element value to same number and send it:
Send the value to pin without updating anything and outside of pin array:
Send function name to device. If name is not defined it will use fn data (declaring fn should be avoided if you don't want to send function on sendValue) event.
Send string to device. Similar to involt.sendToDevice(string).