This ESP32 program connects to a mobile device via Bluetooth Low Energy (BLE) and fetches character data from "The Wolf Among Us" API endpoints to send to the connected device.
- BLE connectivity with custom service and characteristics
- WiFi network scanning and connection handling
- The Wolf Among Us API endpoints integration:
- Character list fetching
- Detailed character information
- JSON data parsing and transmission
- ESP32 development board
- USB cable for programming and power
- Mobile device with BLE support (for the PIA app)
- Arduino IDE with ESP32 support or VSC with the PlatformIO extension
- Required libraries:
WiFi.hHTTPClient.hArduinoJson.hBLEDevice.hBLEUtils.hBLEServer.h
- Clone this repository
- Open
main.cppin Arduino IDE or PlatformIO - Install required libraries listed above
- Upload to your ESP32
- Device Name:
API_Fetcher - Service UUID:
1b2e4970-7e52-43ed-93ee-7dd01880e8b3 - Characteristic UUID:
bd104210-8851-42d2-a610-3548f79dad88 - Properties:
READ,WRITE,NOTIFY
The ESP32 responds to the following JSON actions received via BLE:
getNetworks- Scans and returns available WiFi networksconnect- Connects to specified WiFi network (requires ssid and password)getData- Fetches and returns character listgetDetails- Fetches detailed character information (requires character id)
- ESP32 boots and starts BLE advertising
- Mobile app connects to device
API_Fetcher - App can
- Request WiFi networks list
- Send WiFi credentials to connect to a network
- Request character data
- Request specific character details
- ESP32 processes requests and sends responses via BLE notifications
The main functionality is implemented in main.cpp with:
- WiFi connection handling
- BLE server setup with callbacks
- Characteristic callback handler for processing requests
- HTTP client for API communication
- JSON parsing and response generation
{
"ssid": "MyWiFi",
"strength": -65,
"encryption": 3,
"teamId": "A35"
}{
"id": "28",
"name": "Nerissa",
"image": "/path/to/image.jpg",
"teamId": "A35"
}{
"name": "Nerissa",
"image": "/path/to/image.jpg",
"description": "Nerissa's story...",
"teamId": "A35"
}- Connection issues: Ensure ESP32 is powered properly and in range
- WiFi problems: Verify credentials and network availability
- API failures: Check if endpoints are accessible
- Serial monitor: Use 115200 baud for debug output