Connecting the robot to the cloud
Now that we are sure that the wheels are working correctly, we are going to connect the robot to the aREST cloud platform, so it can be controlled from anywhere in the world.
As the sketch is quite big and takes a lot from the motor test sketch we saw earlier, I will only go through the most important points here. You can of course find the complete sketch inside the GitHub repository for the book.
It starts by importing the correct libraries:
#include <ESP8266WiFi.h> #include <PubSubClient.h> #include <aREST.h>
Then, we create the client to communicate with the aREST cloud server:
WiFiClient espClient; PubSubClient client(espClient);
We also create an instance of the aREST client:
aREST rest = aREST(client);
Then, as ...
Get Internet of Things with ESP8266 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.