Using REST to read/write variables.

Hi,

After having diging for hours I can't find my answer.

Using the Arduino Yun Bridge tutorial (https://www.arduino.cc/en/Tutorial/Bridge) I would like to do the same thing that the analogCommand but on an Arduino variable and not a pin.

Let's say, I have a variable on my sketch "lightDim" which is an integer that store a value send to an analogWrite. I would like to be able, from my browser to use the "http://1.2.3.4/arduino/variable/lightDim" to get the value of the variable.

And if it is possible to use my browser to use "http://1.2.3.4/arduino/variable/lightDim/50" to set that variable to the value of 50.

Francois X.

Look at the process() function. It determines the action to perform based on the portion of the URL after the arduino bit.

Create a new function, variableCommand(), and add the code to call it when the command is "variable".

Follow the example of the other commands to get the rest of the data.