-
Notifications
You must be signed in to change notification settings - Fork 1
Installation Guide
GALIH RIDHO UTOMO edited this page Feb 24, 2025
·
1 revision
This page provides detailed instructions for installing and configuring the GitHub IoT Arduino Module.
Before installing the library, ensure you have:
- Arduino IDE (1.8.x or later)
- ESP8266 or ESP32 board support installed
- GitHub Account with repository creation privileges
- Internet connectivity for your IoT device
The following libraries are required:
- ArduinoJson (v6.x or later)
- base64 library
- WiFi and HTTPClient libraries (included in ESP core packages)
- Open the Arduino IDE
- Navigate to Sketch > Include Library > Manage Libraries
- In the search box, type "githubiot"
- Find the library in the list and click INSTALL
- Install any dependencies if prompted
- Download the library ZIP file from the GitHub repository
- In the Arduino IDE, go to Sketch > Include Library > Add .ZIP Library
- Select the downloaded ZIP file
- Restart the Arduino IDE
- Create a new repository on GitHub or use an existing one
- Generate a Personal Access Token:
- Go to GitHub Settings > Developer settings > Personal access tokens
- Click Generate new token
- Select the repo scope
- Copy the generated token
In your Arduino sketch:
#include <githubiot.h>
// GitHub configuration
const char* token = "Bearer ghp_your_token_here"; // Note the "Bearer " prefix
const char* repo_url = "https://github.com/ghapi/repos/username/repo/contents/filename.json";
// Initialize the library
githubiot iot_module(token, repo_url);To verify that the library is correctly installed and configured:
- Upload the following test sketch:
#include <githubiot.h>
// WiFi credentials
const char* ssid = "your_wifi_ssid";
const char* password = "your_wifi_password";
// GitHub configuration
const char* token = "Bearer your_token";
const char* repo_url = "https://github.com/ghapi/repos/username/repo/contents/test.json";
githubiot iot_module(token, repo_url);
void setup() {
Serial.begin(115200);
// Connect to WiFi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.print(".");
}
Serial.println("Connected to WiFi");
// Test GitHub connection
String sha = iot_module.get_current_sha();
if (sha != "") {
Serial.println("Successfully connected to GitHub!");
Serial.println("Current SHA: " + sha);
} else {
Serial.println("Failed to connect to GitHub. Check your token and URL.");
}
}
void loop() {
// Nothing here
}- Open the Serial Monitor at 115200 baud
- Verify that the connection is successful
For additional support, see the Troubleshooting page.
This documentation is created to provide a comprehensive guide for this project. Feel free to contribute!
๐
Last updated: February 24, 2025
โ๏ธ Maintained by: Your Name
๐ License: MIT License