README.adoc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. :toc: macro
  2. :toclevels: 4
  3. :sectnums:
  4. toc::[]
  5. = Arduino Cloud Library
  6. Use this library to connect your Arduino/Genuino to Arduino cloud.
  7. To have your configurations ready follow the https://create.arduino.cc/getting-started[getting started] or go to the https://cloud.arduino.cc/cloud[cloud dashboard].
  8. == Supported devices
  9. === Zero + WiFi101, MKR1000
  10. IMPORTANT: Make sure to have the correct SSL certificate for arduino.cc. Look https://github.com/arduino-libraries/WiFi101-FirmwareUpdater#to-update-ssl-certificates[here] for the the update instuctions.
  11. === Yun-Shield
  12. IMPORTANT: The yun or yun shield firmware should be >=1.6.2. Look https://www.arduino.cc/en/Tutorial/YunSysupgrade[here] for the the upgrade instuctions.
  13. == Credits
  14. The library is based on the https://eclipse.org/paho/clients/c/embedded/[Paho Library].
  15. Special thanks to Joël Gähwiler author of https://github.com/256dpi/arduino-mqtt[arduino-mqtt library] for his work on porting the paho library on Arduino.
  16. == APIs
  17. === Setup and Configuration
  18. - `ArduinoCloudThing()`
  19. - `void begin(const char* name, const char* username, const char* id, const char* password, Client &client)`
  20. === Property configuration
  21. ==== Simple property
  22. - `void addProperty(const char* name, const char* datatype, const char* permission)`
  23. ==== Policy managed property
  24. Is possible to specify a policy as:
  25. - ON_CHANGE: the value will be written only if it is changed
  26. - TIMED: is necessary to specify a lapse (seconds)
  27. - `void addProperty(const char* name, const char* datatype, const char* permission, const char* policy)`
  28. - `void addProperty(const char* name, const char* datatype, const char* permission, const char* policy, int lapse)`
  29. ==== Other object property
  30. An object can also read or write a property of another object, is just necessary to specify the other object's name
  31. - `void addExternalProperty(const char* other_device_name, const char* name, const char* datatype)`
  32. === Write properties
  33. - `void writeProperty(const char* name, char* value)`
  34. - `void writeProperty(const char* name, float value)`
  35. - `void writeProperty(const char* name, int value)`
  36. - `void writeProperty(const char* name, String value)`
  37. === Read properties
  38. - `String readProperty(const char* name)`
  39. - `String readProperty(const char* other_device_name, const char* name)`
  40. === Extra
  41. - `void poll()`
  42. - `void push()`
  43. - `void enableDebug()`
  44. - `void disableDebug()`
  45. == Variables
  46. ### Permissions
  47. - `R` - The property can be only written from the device
  48. - `RW` - The property can be written and from the device and can update the value from other objects
  49. ### Polices
  50. - `TIMED` - Waiting seconds before update a new data
  51. - `ON_CHANGE` - Publish value only on change
  52. ### Data Type
  53. #### Standard
  54. - `CHARSTRING`
  55. - `FLOAT`
  56. - `INT`
  57. #### Temperature
  58. - `TEMPERATURE_C` - celsius
  59. - `TEMPERATURE_F` - fahrenheit
  60. #### Lenght
  61. - `LENGHT_M` - meters
  62. - `LENGHT_C` - centimeters
  63. - `LENGHT_I` - inches
  64. #### Vars
  65. - `PERCENTAGE`
  66. - `ANALOG`
  67. - `LUMEN`
  68. - `PPM` - gas part per million
  69. - `STATUS` - on/off
  70. == Debug
  71. The default debug output is on SerialUSB, in order to change the output is necessary to edit CLOUD_DEBUG_SERIAL at the begin of `src/ArduinoCloudThingBase.h`