The Particle Cloud let’s us do lots of awesome things like put functions and variables from our microcontroller online quickly so other internet-connected devices from web-browsers to smart devices can talk to them.
It also provides some pretty powerful methods for: sharing data with other devices and services (events) and pulling data in from online sources to our devices (webhooks). We’ll explore both in this section.
Though the Particle Cloud’s events model, we can pass useful messages to devices that are interested in hearing what our microcontroller’s got to say. An event is like a mini message that you can share them from your device or from anything with access to the Cloud API. This process of sharing is commonly refered to as ‘publishing an event’. Devices can also ‘listen’ for events from other devices that they might be interested in. Devices will register to be notified of new events and then as you share (or publish an event), those devices that are subscribed to your events will be notified and can act on the information.
In the next section we’ll explore events as a great way to pass information between internet appliances and nudge them to do cool stuff with it.
- Guide: Particle Cloud and Events
- Tutorial: A PIR and Particle.publish()
- Code Sample: Paired Devices Template Code
- Tips and Tricks Working with Networking
There’s lots of data stored on the Internet. Often web applications make this data accessible through _API_s or application programming interfaces. These are easy ways for web applications to access information but our microcontroller is limited in processing power, memory and ways to interact with web content and the often detailed responses that a web request might return.
Particle makes this process much easier by using it’s cloud services as the middleman between the requests from our device for information and the information itself. It does this through ‘webhooks’. When the Photon wants to find out come info from an online service (the weather, how many emails you have, if a stock price is up or down, etc.), the microcontroller can trigger a request to that service. The Particle Cloud manages the request to that source and returns it to the device in a streamlined format.
In this section, we’ll take a look at webhooks and some examples of retrieving information from the web.
Practice Exercise: Paired Devices