Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# PxServ Docs / Dokümantasyonu
# PxServ Documentation

🇹🇷 **TR** : Bu dokümantasyon, PxServ API'lerinin ve kütüphanelerinin nasıl kullanılacağını ve bu sistemlerle nasıl iletişim kurulacağını açıklamaktadır. Amacımız, PxServ'in sunduğu hizmetleri en verimli şekilde kullanabilmeniz için ihtiyaç duyduğunuz tüm bilgileri sağlamaktır.
🇺🇸 **EN** — This documentation covers the PxServ APIs, client libraries, and real-time connection layer. Use it to integrate PxServ into any software or hardware project.

🇺🇸 **EN** : This documentation explains how to use the PxServ APIs and libraries and how to communicate with these systems. Our goal is to provide you with all the information you need to make the most efficient use of PxServ's services.
🇹🇷 **TR** — Bu dokümantasyon, PxServ API'lerini, istemci kütüphanelerini ve gerçek zamanlı bağlantı katmanını kapsamaktadır. PxServ'i herhangi bir yazılım veya donanım projesine entegre etmek için kullanın.
2 changes: 1 addition & 1 deletion SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@
* [Real-Time Connection (Socket.IO)](en/realtime-connection-socket.io.md)
* [Example Projects](en/example-projects/README.md)
* [Home Security System](en/example-projects/home-security-system.md)
* [Smart Temperature Monitor:](en/example-projects/smart-temperature-monitor.md)
* [Smart Temperature Monitor](en/example-projects/smart-temperature-monitor.md)
108 changes: 44 additions & 64 deletions en/arduino-library.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,84 +4,64 @@ icon: gear-code

# Arduino Library

This example code allows you to perform database operations with the PxServ project. You can perform the following operations:
The PxServ Arduino library enables direct communication with the PxServ API from Arduino-compatible devices (ESP32, ESP8266, etc.).

- Save data to the database
- Toggle data between 0 and 1 in the database
- Read data from the database
- Delete data from the database
**Supported operations:**

## Requirements

Before using this example, make sure the following libraries are installed in the Arduino IDE:
* Save data to the database
* Toggle a value between `0` and `1`
* Read data from the database
* Delete data from the database

- **PxServ.h**: To communicate with the PxServ API.
## Requirements

## Connection Settings
Install the following library in the Arduino IDE before use:

You need to enter the Wi-Fi connection information and your PxServ API key in the required fields in the code under the usage heading.
* **PxServ.h** — PxServ API client

## Usage

In the following example code, the database operations using the PxServ API are explained step by step with comments; the functionality of each operation and how it works is described within the code.

```cpp
#include <PxServ.h>

// PxServ API Key (Enter your project API key here)
PxServ client("your_pxserv_api_key");

void setup()
{
// Wi-Fi settings (Wi-Fi SSID and Password)
Serial.begin(115200);
PxServ::connectWifi("your_wifi_ssid", "your_wifi_password");
void setup() {
Serial.begin(115200);
PxServ::connectWifi("your_wifi_ssid", "your_wifi_password");
}

void loop()
{
// Save data
PxServ::Callback setResult = client.setData("exampleData1", "value"); // Add "value" to the "exampleData1" key
Serial.print("Set Result -> Status: ");
Serial.print(setResult.status);
Serial.print(" | Message: ");
Serial.print(setResult.message);
Serial.print(" | Data: ");
Serial.println(setResult.data);

delay(2000); // Wait for two seconds

// Toggle data
PxServ::Callback toggleResult = client.toggleData("exampleData2"); // Toggles the value of the “exampleData2” key between 0 and 1
Serial.print("Toggle Result -> Status: ");
Serial.print(toggleResult.status);
Serial.print(" | Message: ");
Serial.print(toggleResult.message);
Serial.print(" | Data: ");
Serial.println(toggleResult.data);

delay(2000); // Wait for two seconds

// Get data
PxServ::Callback getResult = client.getData("exampleData1"); // Get the value for the "exampleData1" key
Serial.print("Get Result -> Status: ");
Serial.print(getResult.status);
Serial.print(" | Message: ");
Serial.print(getResult.message);
Serial.print(" | Data: ");
Serial.println(getResult.data);

delay(2000); // Wait for two seconds

// Remove data
PxServ::Callback removeResult = client.removeData("exampleData1"); // Remove the "exampleData" key
Serial.print("Remove Result -> Status: ");
Serial.print(removeResult.status);
Serial.print(" | Message: ");
Serial.print(removeResult.message);
Serial.print(" | Data: ");
Serial.println(removeResult.data);

delay(2000); // Wait for two seconds
void loop() {
// Save data
PxServ::Callback setResult = client.setData("exampleData1", "value");
Serial.print("Set -> Status: "); Serial.print(setResult.status);
Serial.print(" | Message: "); Serial.print(setResult.message);
Serial.print(" | Data: "); Serial.println(setResult.data);

delay(2000);

// Toggle data (cycles between 0 and 1)
PxServ::Callback toggleResult = client.toggleData("exampleData2");
Serial.print("Toggle -> Status: "); Serial.print(toggleResult.status);
Serial.print(" | Message: "); Serial.print(toggleResult.message);
Serial.print(" | Data: "); Serial.println(toggleResult.data);

delay(2000);

// Read data
PxServ::Callback getResult = client.getData("exampleData1");
Serial.print("Get -> Status: "); Serial.print(getResult.status);
Serial.print(" | Message: "); Serial.print(getResult.message);
Serial.print(" | Data: "); Serial.println(getResult.data);

delay(2000);

// Remove data
PxServ::Callback removeResult = client.removeData("exampleData1");
Serial.print("Remove -> Status: "); Serial.print(removeResult.status);
Serial.print(" | Message: "); Serial.print(removeResult.message);
Serial.print(" | Data: "); Serial.println(removeResult.data);

delay(2000);
}
```
6 changes: 6 additions & 0 deletions en/example-projects/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ icon: vial

# Example Projects

End-to-end project examples demonstrating PxServ integration with real hardware.

| Project | Description |
| ------- | ----------- |
| [Home Security System](home-security-system.md) | Motion detection with real-time alerts via ESP32 |
| [Smart Temperature Monitor](smart-temperature-monitor.md) | Periodic temperature and humidity logging with DHT11 |
11 changes: 8 additions & 3 deletions en/example-projects/home-security-system.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Home Security System

Detects motion using a PIR sensor connected to an ESP32, triggers a buzzer, and sends an alert to PxServ. The system can be remotely disabled by updating the `system_status` key via the PxServ dashboard or API.

**Hardware:** ESP32, PIR motion sensor, buzzer\
**Libraries:** `WiFi.h`, `PxServ.h`

```cpp
#include <WiFi.h>
#include <PxServ.h>
Expand All @@ -16,7 +21,7 @@ void setup() {
pinMode(MOTION_SENSOR, INPUT);
pinMode(BUZZER, OUTPUT);
WiFi.begin(WIFI_SSID, WIFI_PASS);

while (WiFi.status() != WL_CONNECTED) {
delay(500);
}
Expand All @@ -29,12 +34,12 @@ void loop() {
delay(1000);
digitalWrite(BUZZER, LOW);
}

PxServ::Callback result = client.getData("system_status");
if (result.data == "disabled") {
digitalWrite(BUZZER, LOW);
}

delay(1000);
}
```
15 changes: 10 additions & 5 deletions en/example-projects/smart-temperature-monitor.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Smart Temperature Monitor:
# Smart Temperature Monitor

Reads temperature and humidity from a DHT11 sensor connected to an ESP32 and uploads the values to PxServ every 5 minutes.

**Hardware:** ESP32, DHT11 sensor\
**Libraries:** `WiFi.h`, `PxServ.h`, `DHT.h`

```cpp
#include <WiFi.h>
Expand All @@ -17,7 +22,7 @@ void setup() {
Serial.begin(115200);
WiFi.begin(WIFI_SSID, WIFI_PASS);
dht.begin();

while (WiFi.status() != WL_CONNECTED) {
delay(500);
}
Expand All @@ -26,10 +31,10 @@ void setup() {
void loop() {
float temp = dht.readTemperature();
float hum = dht.readHumidity();

client.setData("temperature", String(temp));
client.setData("humidity", String(hum));
delay(300000); // Update every 5 minutes

delay(300000); // 5-minute interval
}
```
Loading