Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In order for actions on the Application interface like (Click on the Led) and it to turn on the Led on the Arduino, we need the name of the Widget to be the same name that we defined in the arduino code using: ODev.addDevice("Led", 13, Device::DIGITAL); // LINE 11

Now to send information from the Arduino to the Application, one way is to define a sensor, using: ODev.addSensor("Name", ....).
Taking line 13 as an example. Note that in this example we are passing a function: readTemperature, it will be responsible for the reading code. (That way any sensor can be read).
Yet in line 13, we define the interval of 200ms that the sensor should be read.

Info

OpenDevice supports some types of sensors, and it is still possible read digital/analog sensors directly without having to pass a function, using: ODev.addSensor ("Switch", 11, Device :: DIGITAL);

What's ahead?

Please check for more options to send and receive data: Use Cases

How communication work ?

When you add a button and click on it, a command is sent to the Device (Ex. Arduino).
This command follows a communication protocol.

See more details: How communication work

Status
colourRed
titlecomplementar
falar sobre como usar os nomes e os custom commands, talvez explicar um pouco do código.