[{"data":1,"prerenderedAt":39},["ShallowReactive",2],{"example-page-picow-web":3},{"id":4,"info":5,"parts":6,"wired":14,"refs":15,"nets":16,"moreNets":33,"code":34},"picow-web","Raspberry Pi Pico W with a real Wi-Fi stack (cyw43 driver + the firmware's lwIP) on a virtual network: it connects to the router \"CircuitLab\", gets an address over DHCP and starts a web server. In the \"Network\" panel (at the bottom), load the board's page and switch the LED; button SW1 on GP15 appears on the page. Traffic log with DHCP, DNS and HTTP.",[7,10,12],[8,9],"button",1,[11,9],"rpi_pico_w",[13,9],"wifi_router",false,{"A1":11,"SW1":8},[17,26],{"name":18,"pins":19},"0",[20,23],[21,22],"A1","GND",[24,25],"SW1","2",{"name":27,"pins":28},"BTN",[29,31],[21,30],"GP15",[24,32],"1",0,{"file":35,"lang":36,"text":37,"lines":38,"more":14},"sketch.ino","cpp","\u002F\u002F Pico W as a web server: a page with buttons switches the onboard LED and shows the button on GP15\n\u002F\u002F Load the board's page in the \"Network\" panel (http:\u002F\u002F\u003CIP>\u002F). Network: Wi-Fi router in the schematic.\n#include \u003CWiFi.h>\n#include \u003CWebServer.h>\n\nconst char* SSID = \"CircuitLab\";\nconst char* PASS = \"secret123\";\nconst int BUTTON = 15;\nWebServer server(80);\nbool led = false;\n\nString page() {\n  String s = \"\u003C!doctype html>\u003Chtml>\u003Chead>\u003Cmeta charset='utf-8'>\u003Ctitle>Pico W\u003C\u002Ftitle>\"\n             \"\u003Cstyle>body{font-family:sans-serif;margin:24px}a{display:inline-block;padding:8px 16px;margin:4px;border-radius:6px;background:#0f766e;color:#fff;text-decoration:none}\u003C\u002Fstyle>\u003C\u002Fhead>\u003Cbody>\";\n  s += \"\u003Ch1>Pico W web server\u003C\u002Fh1>\";\n  s += \"\u003Cp>LED is \u003Cb>\" + String(led ? \"ON\" : \"OFF\") + \"\u003C\u002Fb>\u003C\u002Fp>\";\n  s += \"\u003Cp>\u003Ca href='\u002Fon'>LED on\u003C\u002Fa>\u003Ca href='\u002Foff'>LED off\u003C\u002Fa>\u003C\u002Fp>\";\n  s += \"\u003Cp>Button on GP15: \" + String(digitalRead(BUTTON) == LOW ? \"pressed\" : \"released\") + \"\u003C\u002Fp>\";\n  s += \"\u003Cp>Uptime: \" + String(millis() \u002F 1000) + \" s\u003C\u002Fp>\u003C\u002Fbody>\u003C\u002Fhtml>\";\n  return s;\n}\n\nvoid setup() {\n  Serial.begin(115200);\n  pinMode(LED_BUILTIN, OUTPUT);\n  pinMode(BUTTON, INPUT_PULLUP);\n  WiFi.begin(SSID, PASS);\n  Serial.print(\"Connecting to \"); Serial.println(SSID);\n  while (WiFi.status() != WL_CONNECTED) delay(100);\n  Serial.print(\"Connected, IP: \"); Serial.println(WiFi.localIP());\n  server.on(\"\u002F\", []() { server.send(200, \"text\u002Fhtml\", page()); });\n  server.on(\"\u002Fon\", []() { led = true; digitalWrite(LED_BUILTIN, HIGH); server.send(200, \"text\u002Fhtml\", page()); });\n  server.on(\"\u002Foff\", []() { led = false; digitalWrite(LED_BUILTIN, LOW); server.send(200, \"text\u002Fhtml\", page()); });\n  server.begin();\n}\n\nvoid loop() { server.handleClient(); }",37,1796304401005]