> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hyperwisor.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Arduino — Provisioning

> Get a device onto Wi-Fi and linked to an account — AP-mode or manual.

Provisioning gives a device its Wi-Fi credentials and identity (device ID and
user). The library persists these in `Preferences`, so it only happens once;
on later boots the device connects automatically.

## What `begin()` does

When you call `device.begin()`, the library:

1. Tries to connect with saved Wi-Fi credentials
2. Starts **AP-mode** if nothing is configured
3. Sets up DNS + an HTTP provisioning page
4. Initializes the realtime connection
5. Loads `deviceid`, `ssid`, `email`, `productid`, and `versionid` from storage
6. Registers default and user-provided command handlers

```cpp theme={null}
#include <hyperwisor-iot.h>
HyperwisorIOT device;

void setup() {
  Serial.begin(115200);
  device.begin();
}

void loop() {
  device.loop();
}
```

## AP-mode provisioning (first boot)

If the device has no saved credentials, it starts its own Wi-Fi access point and
serves a setup page:

|             |                        |
| ----------- | ---------------------- |
| AP SSID     | `NIKOLAINDUSTRY_Setup` |
| AP password | `0123456789`           |

Connect to that network, open the provisioning page, and enter Wi-Fi + device
details. The device saves them and restarts, connecting automatically from then
on.

## Manual provisioning

To set credentials from code instead of the AP page:

```cpp theme={null}
// Wi-Fi + identity in one call (userId optional)
device.setCredentials("MySSID", "MyPassword", "my-device-id", "my-user-id");

// Or individually
device.setWiFiCredentials("MySSID", "MyPassword");
device.setDeviceId("my-device-id");
device.setUserId("my-user-id");
```

Helpers to inspect and reset stored credentials:

```cpp theme={null}
if (device.hasCredentials()) { /* already provisioned */ }
device.clearCredentials();     // wipe and re-provision
```

## Reading identity at runtime

```cpp theme={null}
String id   = device.getDeviceId();
String user = device.getUserId();
```

<Card title="Next: API reference" icon="book" href="/firmware/arduino/api-reference">
  Every method you can call on the device.
</Card>
