Skip to content

Add Elixir WiFi example#27

Merged
UncleGrumpy merged 1 commit intoatomvm:masterfrom
mnishiguchi:feat/add-elixir-wifi-example
Jan 25, 2026
Merged

Add Elixir WiFi example#27
UncleGrumpy merged 1 commit intoatomvm:masterfrom
mnishiguchi:feat/add-elixir-wifi-example

Conversation

@mnishiguchi
Copy link
Copy Markdown
Contributor

@mnishiguchi mnishiguchi commented Jan 24, 2026

Add an Elixir WifiExample that mirrors the Erlang wifi example (STA + AP configuration + SNTP sync) and document it alongside the other Elixir examples.

I tested this example with my ESP32-S3.

The log output looks like this:


Terminal ready
2a0dch (172252) map
I (3134) wifi:ap channel adjust o:1,1 n:11,2
I (3134) wifi:new:<11,0>, old:<1,1>, ap:<11,2>, sta:<11,0>, prof:1, snd_ch_cfg:0x0
I (3134) wifi:state: init -> auth (0xb0)
I (3134) wifi:state: auth -> assoc (0x0)
I (3144) wifi:state: assoc -> run (0x10)
I (3174) wifi:connected with aterm-4dc33e-g, aid = 2, channel 11, BW20, bssid = 1c:7c:98:0c:f7:b6
I (3174) wifi:security: WPA2-PSK, phy: bgn, rssi: -57
I (3174) wifi:pm start, type: 1

I (3174) wifi:dp: 1, bi: 102400, li: 3, scale listen interval from 307200 us to 307200 us
I (3184) wifi:set rx beacon pti, rx_bcn_pti: 0, bcn_timeout: 25000, mt_pti: 0, mt_time: 10000
I (3194) network_driver: WIFI_EVENT_STA_CONNECTED received.
STA connected
I (3214) wifi:AP's beacon interval = 102400 us, DTIM period = 1
I (6694) esp_netif_handlers: sta ip: 192.168.10.125, mask: 255.255.255.0, gw: 192.168.10.1
I (6694) network_driver: IP_EVENT_STA_GOT_IP: 192.168.10.125
Got IP: {{192, 168, 10, 125}, {255, 255, 255, 0}, {192, 168, 10, 1}}
Date: 1970/01/01 00:00:33 (33996ms)
Date: 1970/01/01 00:00:39 (39015ms)
Date: 1970/01/01 00:00:44 (44029ms)
Date: 1970/01/01 00:00:49 (49043ms)
Date: 1970/01/01 00:00:54 (54058ms)
Date: 1970/01/01 00:00:59 (59072ms)
I (35164) network_driver: SNTP_EVENT_BASE_SYNC received.
I (35164) network_driver: Posting SNTP synchronization event
Synchronized time with SNTP server {4596579709683550371, 1070339556}
Date: 2026/01/24 13:27:00 (1769261220953ms)
Date: 2026/01/24 13:27:05 (1769261225968ms)
...

@mnishiguchi mnishiguchi force-pushed the feat/add-elixir-wifi-example branch from 2e49a5e to 1afc2ff Compare January 24, 2026 13:31
@UncleGrumpy
Copy link
Copy Markdown
Collaborator

Thank you for this contribution! This looks great, and should work just fine on Pico W chips as well as ESP32. I will test soon and make sure, before we have you update the README and adjust verify_platform/1.

Copy link
Copy Markdown
Collaborator

@UncleGrumpy UncleGrumpy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple minor details. This will also work for wifi enabled pico devices, just one minor code change needed. Also lets keep the directory and app name consistent with the other Elixir examples.

@UncleGrumpy
Copy link
Copy Markdown
Collaborator

I realize LEDC_Example has doesn't follow the correct naming scheme, I take responsibility for that! I should submit a fix to rename it, and update it to use Elixir IO - AtomVM added support for it since the ledc example was added here.

Copy link
Copy Markdown
Collaborator

@UncleGrumpy UncleGrumpy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Thank you! One last little nit-picky request. Can you flatten (or squash) your commits into a single commit? All of the AtomVM org repos like to keep a clean git history, we do not need the extra review requested changes in the log.

@mnishiguchi mnishiguchi force-pushed the feat/add-elixir-wifi-example branch from 3101c58 to 9e346ce Compare January 25, 2026 07:49
Copy link
Copy Markdown
Collaborator

@UncleGrumpy UncleGrumpy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you again for the contribution!

@UncleGrumpy UncleGrumpy merged commit 23f6b12 into atomvm:master Jan 25, 2026
2 checks passed
@mnishiguchi mnishiguchi deleted the feat/add-elixir-wifi-example branch January 25, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants