Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

Commit 30e5aef

Browse files
committed
add example
Signed-off-by: Benny Zlotnik <bzlotnik@protonmail.com>
1 parent 962bb44 commit 30e5aef

2 files changed

Lines changed: 57 additions & 0 deletions

File tree

packages/jumpstarter-driver-esp32/README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,44 @@ export:
3434
| boot_pin | GPIO pin number for boot mode control (if connected) | int | no | null |
3535
3636
## API Reference
37+
38+
```{autoclass} jumpstarter_driver_esp32.driver.ESP32
39+
:members:
40+
```
41+
42+
# Examples
43+
44+
```{testcode}
45+
from jumpstarter.common.utils import env
46+
from jumpstarter.config.client import ClientConfigV1Alpha1
47+
48+
def main():
49+
try:
50+
# Try to use existing JUMPSTARTER_HOST environment variable
51+
with env() as client:
52+
run_esp32_example(client)
53+
except RuntimeError:
54+
# Fallback to creating a lease (requires jumpstarter configuration)
55+
config = ClientConfigV1Alpha1.load("default")
56+
with config.lease(selector="driver=esp32") as lease:
57+
with lease.connect() as client:
58+
run_esp32_example(client)
59+
60+
def run_esp32_example(client):
61+
esp32 = client.esp32
62+
63+
# Get chip information
64+
info = esp32.chip_info()
65+
print(f"Connected to {info['chip_revision']}")
66+
print(f"MAC Address: {info['mac_address']}")
67+
68+
# Flash firmware
69+
result = esp32.flash_firmware_file("firmware.bin", address=0x10000)
70+
print(result)
71+
72+
# Reset device to run new firmware
73+
esp32.reset()
74+
75+
if __name__ == "__main__":
76+
main()
77+
```
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env python3
2+
import os
3+
from jumpstarter.common.utils import env
4+
from jumpstarter.config.client import ClientConfigV1Alpha1
5+
6+
def main():
7+
with env() as client:
8+
esp32 = client.esp32
9+
10+
info = esp32.chip_info()
11+
print(f"Connected to {info['chip_revision']}")
12+
print(f"MAC Address: {info['mac_address']}")
13+
14+
15+
if __name__ == "__main__":
16+
main()

0 commit comments

Comments
 (0)