This page serves as the documentation to the this official Poluino library. This page assumes that you have experience in making Arduino Sketches.
New to Arduino Sketches? Visit this: https://www.arduino.cc/en/Tutorial/Sketch
- ArduinoJson By Bartoz Bielawski
- PoluinoESP8266 By Poluino
If you need help in installing the libraries, check out this link: https://www.arduino.cc/en/Guide/Libraries
Install the ESP8266 Boards from this link: https://randomnerdtutorials.com/how-to-install-esp8266-board-arduino-ide/
After installing the boards, select your board.
Now that we have our dependencies in place, let's make a script that logs in our bot.
Open up a new sketch in the ArduinoIDE and follow along.
We need to import the above mentioned libraries into our sketch.
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <WiFiClientSecureBearSSL.h>
#include <ArduinoJson.h>
#include <ESP8266HTTPClient.h>
#include <PoluinoESP8266.h>
- ESP8266WiFi is used to connect the ESP8266 to your WiFi Network.
- ArduinoJson is used to create json document which we will sent to the website using an API.
- ESP8266HTTPClient is used to make HTTP/HTTPS requests such as POST.
- PoluinoESP8266 is used to easily access the Poluino API.
Board station("*your-board-token*");
long timerDelay = ;
Enter a suitable interval at which your device will send data to our server.
Caution: The time should be set in milliSeconds, eg: 5 seconds = 5000
void setup() {
Serial.begin(115200);
Serial.print("Connecting...");
Serial.println();
WiFi.begin("*your_wifi_name*", "*your_pass*");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
if (WiFi.status() == WL_CONNECTED){
Serial.println();
Serial.println("Connected to: ");
Serial.println(WiFi.SSID());
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
Serial.print("Login Status: ");
Serial.println(station.login());
}
In the 3rd line, replace your_wifi_name and your_pass with your credentials. This enables the ESP32 to connect to your Home / Office WiFi Network.
void loop() {
Serial.print("Login Status: ");
Serial.println(station.login());
delay(timerDelay);
}