Skip to content

Commit 883b1b6

Browse files
mrozyckikrzmaz
authored andcommitted
Print IP address after connecting to the network
1 parent d74782c commit 883b1b6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ int main() {
3838
return 1;
3939
} else {
4040
printf("Connected.\n");
41+
42+
extern cyw43_t cyw43_state;
43+
auto ip_addr = cyw43_state.netif[CYW43_ITF_STA].ip_addr.addr;
44+
printf("IP Address: %lu.%lu.%lu.%lu\n", ip_addr & 0xFF, (ip_addr >> 8) & 0xFF, (ip_addr >> 16) & 0xFF, ip_addr >> 24);
4145
}
4246

4347
run_server();

0 commit comments

Comments
 (0)