Basic Gateway
This example shows a minimal ArmorLink Gateway.
The Gateway is the central coordinator of an ArmorLink network.
It handles:
- Command routing
- Module pairing
- Module discovery
- BLE communication with the ArmorLink App
For the conceptual overview, see Gateway.
Sketch
#include <ArmorLink.h>
ArmorLinkModule module(
"Chest",
ArmorLinkModuleType::Chest
);
void setup()
{
Serial.begin(115200);
delay(500);
ArmorLinkOptions options;
options.enableGateway = true;
options.enableEspNow = true;
options.enableBle = true;
options.enableSerialMenu = true;
options.bleName = "ArmorLink Gateway";
ArmorLink.begin(module, options);
ArmorLink.info("Gateway started");
}
void loop()
{
ArmorLink.loop();
}
What This Example Does
This sketch creates a Gateway module named Chest.
ArmorLinkModule module(
"Chest",
ArmorLinkModuleType::Chest
);
It enables Gateway mode:
options.enableGateway = true;
It enables ESP-NOW communication for other modules:
options.enableEspNow = true;
It enables BLE communication for the ArmorLink App:
options.enableBle = true;
It enables the serial pairing menu:
options.enableSerialMenu = true;
Pairing Modules
Open the Serial Monitor and start pairing:
start
List pairing candidates:
candidates
Pair the first candidate:
pair 1
List paired modules:
modules
For more information, see Pairing.
App Connection
Since BLE is enabled, the ArmorLink App can connect to the Gateway.
The App can then:
- Discover paired modules
- Execute Actions
- Edit Configuration
- View Telemetry
- View Remote Logs
- Start Pairing
When to Use This Example
Use this sketch when you want to create a dedicated Gateway or start a multi-module ArmorLink project.
Next Steps
Continue with: