External API Reference
This page indexes the external ESP32 platform APIs commonly used alongside the M5Cardputer library. These are not part of M5Cardputer β click through to each library's official documentation for full API details.
WiFi
| Library |
Source |
Key Classes / Functions |
| arduino-esp32 WiFi |
Documentation |
WiFi.begin(), WiFi.status(), WiFi.localIP(), WiFi.disconnect() |
#include <WiFi.h>
WiFi.begin("SSID", "password");
while (WiFi.status() != WL_CONNECTED) { delay(500); }
HTTP Client
| Library |
Source |
Key Classes |
| HTTPClient |
Built into arduino-esp32 |
HTTPClient, begin(), GET(), POST(), getString() |
#include <HTTPClient.h>
HTTPClient http;
http.begin("http://example.com/api");
int code = http.GET();
String body = http.getString();
http.end();
Web Server
| Library |
Source |
Key Classes |
| WebServer |
Built into arduino-esp32 |
WebServer, on(), send(), handleClient() |
MQTT
| Library |
Source |
Key Classes |
| PubSubClient |
GitHub |
PubSubClient, setServer(), connect(), publish(), subscribe(), loop() |
| AsyncMQTTClient |
GitHub |
Async, non-blocking alternative |
#include <PubSubClient.h>
WiFiClient wifiClient;
PubSubClient mqtt(wifiClient);
mqtt.setServer("broker.emqx.io", 1883);
mqtt.connect("cardputer");
mqtt.publish("topic/hello", "data");
mqtt.loop();
Bluetooth (BLE)
| Library |
Source |
Key Classes |
| ESP32 BLE Arduino |
GitHub |
BLEDevice, BLEServer, BLECharacteristic, BLEAdvertising |
| NimBLE |
GitHub |
Lighter stack, lower RAM usage |
#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>
USB HID
| Library |
Source |
Key Classes |
| ESP32TinyUSB |
GitHub |
USBHID, keyboardReport(), mouseReport() |
| Arduino ESP32 USB |
Built-in for ESP32-S2/S3 |
USB.begin(), Keyboard.begin(), Keyboard.print() |
#include <USB.h>
#include <USBHIDKeyboard.h>
USBHIDKeyboard Keyboard;
Keyboard.begin();
Keyboard.print("Hello");
TinyUSB is used by the usbKeyboard example. See examples/Basic/keyboard/usbKeyboard.
SSH Client
| Library |
Source |
Key Classes |
| LibSSH-ESP32 |
GitHub |
SSHClient, connect(), authenticate(), executeCommand() |
Used by the SSHClient example. See examples/Advanced/SSHClient.
FreeRTOS (Multitasking)
TaskHandle_t taskHandle;
xTaskCreatePinnedToCore(
myTask, "TaskName", 4096, NULL, 1, &taskHandle, 0
);
void myTask(void* param) {
while (1) {
// Do work
vTaskDelay(10 / portTICK_PERIOD_MS);
}
}
Warning
The M5Cardputer keyboard reader uses FreeRTOS features internally. Avoid creating tasks on core 0 pin if you use TCA8418KeyboardReader (ADV model) β the ISR runs there.
OTA Updates
| Library |
Source |
| ArduinoOTA |
Built into arduino-esp32 |
| ElegantOTA |
GitHub (Web UI-based) |
#include <ArduinoOTA.h>
ArduinoOTA.begin();
// In loop():
ArduinoOTA.handle();
JSON Parsing
| Library |
Source |
Key Classes |
| ArduinoJson |
GitHub |
StaticJsonDocument, DynamicJsonDocument, deserializeJson(), serializeJson() |
| Tool |
Purpose |
ESP.getFreeHeap() |
Check free DRAM |
ESP.getPsramSize() / ESP.getFreePsram() |
PSRAM info |
ESP.getChipModel() / ESP.getChipCores() |
Chip info |
esp_task_wdt_init() |
Watchdog timer |
Serial.printf() |
Debug output |
See Also