Last week’s studio introduced two types of cloud-based communication supported by Particle’s platform:
Device Variables
Device Functions
Both of these have some limitations:
They are each specific to an individual device, so there isn’t an easy to share information among multiple devices. They also both fail if the device is off-line.
“Clients” of information must use polling to access information with either. That is, a client must either repeatedly call a cloud function to retrieve a return value or must repeatedly read a cloud variable to see if it has changed. Polling is often undesirable for a few reasons:
It’s difficult to decide on the right balance between frequency of polling for responsiveness vs. resource utilization (polling causes network traffic and uses power).
The client has to implement some strategy to do the polling. For instance, it may need to use a timer to repeatedly poll. This can be come difficult to manage and waste resources when polling for multiple things. For example, the client may have to use multiple timers to poll for different items of data.
This week’s studio will focus on:
Particles “Event Streams”, which can be used for many-to-many communication and use a publish-subscribe model rather than polling.
Particle’s JavaScript API, which will allow the UI to communicate with the Embedded system.
Studio Prep (Monday)
At studio time you should have:
Breadboard wired with Photon, your RGB LED, and a button
Completed code from the last studio (control LED via cloud functions)
And you should have:
Reviewed the details of even stream support in firmware (on the embedded device)
Reviewed the details of Particle’s JavaScript API. (You should be aware of the functions and the basic approach it uses to callbacks, bu t you do not need to install it. The Studio repo will include it.) In particular, how to call functions, retrieve variables, publish events, and subscribe to event streams.
End of Module
By the end of this week (end of the modules on embedded and cloud concepts) you should have completed AdaFruit’s All the Internet of Things sequence