1. Cloud Hello
Publish the number of seconds since the ESP32 started to PxServ every ten seconds. With no external circuit, this project isolates Wi-Fi, API-key, and setData() setup.
Level: Beginner · Time: 15 minutes
What you will learn
- Create a PxServ client and connect an ESP32 to Wi-Fi
- Convert a numeric value to
String - Check a request through
PxServ::Callback
Parts
- ESP32 DevKit V1
- Data-capable USB cable
- PxServ Arduino library
1.3.0+
No external wiring is required.
PxServ key
| Key | Example | Meaning |
|---|---|---|
cloud-hello/uptime | 40 | Seconds since boot |
Complete sketch
#include <PxServ.h>
const char* WIFI_SSID = "your_wifi_ssid";
const char* WIFI_PASSWORD = "your_wifi_password";
const char* PXSERV_API_KEY = "your_pxserv_api_key";
PxServ client(PXSERV_API_KEY);
void setup() {
Serial.begin(115200);
PxServ::connectWifi(WIFI_SSID, WIFI_PASSWORD);
}
void loop() {
unsigned long uptimeSeconds = millis() / 1000;
PxServ::Callback result = client.setData(
"cloud-hello/uptime",
String(uptimeSeconds)
);
Serial.print("Status: ");
Serial.print(result.status);
Serial.print(" | Message: ");
Serial.println(result.message);
delay(10000);
}Test
- Replace the three connection values and upload the sketch.
- Open Serial Monitor at
115200baud. - Confirm successful requests return status
200. - Verify
cloud-hello/uptimeincreases in the PxServ panel.
If connection messages never finish, confirm the credentials and use a 2.4 GHz Wi-Fi network. A non-200 response usually indicates an incorrect project API key.
Last updated