{"id":2668,"date":"2022-07-08T09:09:10","date_gmt":"2022-07-08T09:09:10","guid":{"rendered":"https:\/\/picockpit.com\/raspberry-pi\/?p=2668"},"modified":"2023-08-28T08:44:23","modified_gmt":"2023-08-28T08:44:23","slug":"stream-sensor-data-over-wifi-with-raspberry-pi-pico-w","status":"publish","type":"post","link":"https:\/\/picockpit.com\/raspberry-pi\/stream-sensor-data-over-wifi-with-raspberry-pi-pico-w\/","title":{"rendered":"Stream Sensor Data over WiFi with your Raspberry Pi Pico W"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1000\" height=\"563\" src=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/featured-image.jpg\" alt=\"Raspberry Pi Pico W tutorial stream sensor data\" class=\"wp-image-2687\" srcset=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/featured-image.jpg 1000w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/featured-image-300x169.jpg 300w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/featured-image-768x432.jpg 768w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/featured-image-18x10.jpg 18w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/figure>\n\n\n\n<p>Have you ever wanted to stream sensor data with your Raspberry Pi Pico W?<\/p>\n\n\n\n<p>One of the best uses for the Raspberry Pi Pico W involves its ability to serve a web page. This means that you can use it to monitor sensor data from your phone as long as you are in WiFi range. This project will provide a simple basis on how you can monitor acceleration data and also create a digital dice, which is activated when you tap the ADXL343 sensor.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-9-1024x574.png\" alt=\"\" class=\"wp-image-2671\" style=\"width:719px;height:403px\" width=\"719\" height=\"403\" srcset=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-9-1024x574.png 1024w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-9-300x168.png 300w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-9-768x431.png 768w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-9-18x10.png 18w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-9.png 1047w\" sizes=\"auto, (max-width: 719px) 100vw, 719px\" \/><figcaption class=\"wp-element-caption\">Raspberry Pi Pico W connected to an ADXL343<\/figcaption><\/figure>\n<\/div>\n\n\n\n\n<h2 class=\"wp-block-heading\">Video<\/h2>\n\n\n\n<iframe loading=\"lazy\" width=\"1280\" height=\"720\" src=\"https:\/\/www.youtube.com\/embed\/grxjmrPT1zQ\" title=\"Pico W Sensor Server - Display Realtime Sensor data over Wi-Fi\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen=\"\"><\/iframe>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Parts needed<\/h2>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/02\/Raspberry-Pi-Pico-Video-Output-DVI-Sock-withPicoComfort-1024x683-1.jpg\" alt=\"\" class=\"wp-image-1843\" style=\"width:310px;height:207px\" width=\"310\" height=\"207\" srcset=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/02\/Raspberry-Pi-Pico-Video-Output-DVI-Sock-withPicoComfort-1024x683-1.jpg 1024w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/02\/Raspberry-Pi-Pico-Video-Output-DVI-Sock-withPicoComfort-1024x683-1-300x200.jpg 300w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/02\/Raspberry-Pi-Pico-Video-Output-DVI-Sock-withPicoComfort-1024x683-1-768x512.jpg 768w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/02\/Raspberry-Pi-Pico-Video-Output-DVI-Sock-withPicoComfort-1024x683-1-18x12.jpg 18w\" sizes=\"auto, (max-width: 310px) 100vw, 310px\" \/><\/figure>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow\">\n<p><a href=\"https:\/\/buyzero.de\/products\/raspberry-pi-pico-w-h-konfigurator-pico-pico-w-pico-h-pico-wh?variant=43536399958283\"><strong>Raspberry Pi Pico W<\/strong><\/a><\/p>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><a href=\"https:\/\/buyzero.de\/products\/adxl343-triple-axis-accelerometer-2g-4g-8g-16g-w-i2c-spi-stemma-qt-qwiic\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-11.png\" alt=\"\" class=\"wp-image-2673\" style=\"width:282px;height:212px\" width=\"282\" height=\"212\" srcset=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-11.png 800w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-11-300x225.png 300w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-11-768x576.png 768w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-11-16x12.png 16w\" sizes=\"auto, (max-width: 282px) 100vw, 282px\" \/><\/a><\/figure>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow\">\n<p><strong><a href=\"https:\/\/buyzero.de\/products\/adxl343-triple-axis-accelerometer-2g-4g-8g-16g-w-i2c-spi-stemma-qt-qwiic\">ADXL343 &#8211; Triple-Axis Accelerometer<\/a><\/strong><\/p>\n<\/div>\n<\/div>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/buyzero.de\/products\/mb-102-steckbrett-breadboard-830-pins?_pos=3&amp;_sid=236ebf25e&amp;_ss=r\">Breadboard<\/a> <\/li>\n\n\n\n<li><a href=\"https:\/\/buyzero.de\/products\/breadboard-kit?_pos=1&amp;_sid=236ebf25e&amp;_ss=r\">Jumper cables<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">What is the ADXL343?<\/h2>\n\n\n\n<p>Analog Devices&#8217; ADXL343 is a follow-up to its predecessor, the ADXL345. <\/p>\n\n\n\n<p>The sensor can measure three axes of measurement and has four settings of sensitivity,+-2g, +-4g, +-8g or +-16g. The lower range gives more resolution for slow movements, the higher range is good for high-speed tracking.<\/p>\n\n\n\n<p>The ADXL343 also has a CircuitPython library that we can use in MicroPython, making it a lot easier to get started. <\/p>\n\n\n\n<p>You will need to have the headers soldered onto the ADXL343 as well as the Pico W in order to do stream sensor data with your Pico W.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Connecting the ADXL343 to the Pico W<\/h2>\n\n\n\n<p>There are four pins that you need to connect to the Raspberry Pi.<\/p>\n\n\n\n<p>Connect the <strong>VIN<\/strong> pin to a <strong>3.3V output<\/strong> on your Raspberry Pi Pico W;<\/p>\n\n\n\n<p>Connect the <strong>GND <\/strong>to a ground pin on your Pico W;<\/p>\n\n\n\n<p>Connect the <strong>SDA<\/strong> pin to <strong>GPIO0<\/strong>;<\/p>\n\n\n\n<p>Connect the <strong>SCL<\/strong> pin to <strong>GPIO1<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Flashing MicroPython firmware for the Raspberry Pi Pico W<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-12-1024x572.png\" alt=\"\" class=\"wp-image-2678\" style=\"width:702px;height:392px\" width=\"702\" height=\"392\" srcset=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-12-1024x572.png 1024w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-12-300x168.png 300w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-12-768x429.png 768w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-12-18x10.png 18w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-12.png 1429w\" sizes=\"auto, (max-width: 702px) 100vw, 702px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p>First, you will need to flash the MicroPython firmware onto the Pico W, if you haven&#8217;t already.<\/p>\n\n\n\n<p><a href=\"https:\/\/micropython.org\/download\/rp2-pico-w\/rp2-pico-w-latest.uf2\">You can download it here.<\/a><\/p>\n\n\n\n<p>Then, press and hold the BOOTSEL button and plug in your Pico to your computer. You should see a new drive. Copy the .UF2 file you downloaded onto that drive.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Set up Thonny for the Raspberry Pi Pico W<\/h2>\n\n\n\n<p>Open up Thonny. If you haven&#8217;t downloaded it, <a href=\"https:\/\/thonny.org\/\">get it here.<\/a><\/p>\n\n\n\n<p>Set the interpreter to <strong>MicroPython (Raspberry Pi Pico)<\/strong> on the bottom left of the Thonny IDE&#8217;s window.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Copy libraries onto the Pico W<\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-13-1024x649.png\" alt=\"\" class=\"wp-image-2679\" style=\"width:686px;height:435px\" width=\"686\" height=\"435\" srcset=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-13-1024x649.png 1024w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-13-300x190.png 300w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-13-768x487.png 768w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-13-18x12.png 18w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-13.png 1235w\" sizes=\"auto, (max-width: 686px) 100vw, 686px\" \/><\/figure>\n<\/div>\n\n\n<p><\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/pi3g\/pico-w\">Download the libraries and files here from our Github repo.<\/a><\/p>\n\n\n\n<p>You can download a ZIP file by going to that link and clicking the green &#8220;<strong>Code<\/strong>&#8221; button and clicking <strong>Download ZIP<\/strong>. <\/p>\n\n\n\n<p>Once downloaded, unzip it somewhere that you&#8217;ll remember.<\/p>\n\n\n\n<p>Then, in your Thonny IDE, click on <strong>View &gt; Files <\/strong>to see your file system and the Pico W&#8217;s file system.<\/p>\n\n\n\n<p>Navigate to the unzipped files and go into the folder <strong>MicroPython &gt; II Pico W Sensor Server. <\/strong>Copy everything onto your Pico W by right-clicking on each item and clicking &#8220;Upload to \/&#8221;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Modifying the code<\/h2>\n\n\n\n<p>In order to get the Raspberry Pi Pico to connect to your WiFi network, you will need to open up <strong>secrets.py<\/strong> and modify the <strong>ssid <\/strong>and <strong>pw<\/strong>&#8216;s value. Enter your network&#8217;s SSID (name) into the former and the password into the latter. Save the file.<\/p>\n\n\n\n<p>The <strong>index.html<\/strong> is the web page that will be served. The line &#8220;&lt;p&gt;X AccX | Y AccY | Z AccZ&lt;\/p&gt;&#8221; and &lt;p&gt;Result DiceVal&lt;\/p&gt; will be replaced with sensor data when the project runs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Connect your Raspberry Pi Pico to WiFi<\/h2>\n\n\n\n<p>The <strong>main.py <\/strong>is where the action happens. <\/p>\n\n\n\n<p>These lines connect it to your WiFi. Don&#8217;t forget to change the string in <strong>rp2.country<\/strong> if your country is not Germany (DE).<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"\n# Set country to avoid possible errors\nrp2.country('DE')\n\nwlan = network.WLAN(network.STA_IF)\nwlan.active(True)\n# If you need to disable powersaving mode\n# wlan.config(pm = 0xa11140)\n\n# See the MAC address in the wireless chip OTP\nmac = ubinascii.hexlify(network.WLAN().config('mac'),':').decode()\nprint('mac = ' + mac)\n\n# Other things to query\n# print(wlan.config('channel'))\n# print(wlan.config('essid'))\n# print(wlan.config('txpower'))\n\n# Load login data from different file for safety reasons\nssid = secrets['ssid']\npw = secrets['pw']\n\nwlan.connect(ssid, pw)\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\"># <\/span><span style=\"color: #D8DEE9\">Set<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">country<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">to<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">avoid<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">possible<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">errors<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">rp2<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">country<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">DE<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">wlan<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">network<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">WLAN<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">network<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">STA_IF<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">wlan<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">active<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">True<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\"># <\/span><span style=\"color: #D8DEE9\">If<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">you<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">need<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">to<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">disable<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">powersaving<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">mode<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\"># <\/span><span style=\"color: #D8DEE9\">wlan<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">config<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">pm<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">0xa11140<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\"># <\/span><span style=\"color: #D8DEE9\">See<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">the<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">MAC<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">address<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">in<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">the<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">wireless<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">chip<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">OTP<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">mac<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">ubinascii<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">hexlify<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">network<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">WLAN<\/span><span style=\"color: #D8DEE9FF\">()<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">config<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">mac<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">:<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">decode<\/span><span style=\"color: #D8DEE9FF\">()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">mac = <\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">+<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">mac<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\"># <\/span><span style=\"color: #D8DEE9\">Other<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">things<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">to<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">query<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\"># <\/span><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">wlan<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">config<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">channel<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #D8DEE9FF\">))<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\"># <\/span><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">wlan<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">config<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">essid<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #D8DEE9FF\">))<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\"># <\/span><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">wlan<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">config<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">txpower<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #D8DEE9FF\">))<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\"># <\/span><span style=\"color: #D8DEE9\">Load<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">login<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">data<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">from<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">different<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">file<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">for<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">safety<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">reasons<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">ssid<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">secrets<\/span><span style=\"color: #D8DEE9FF\">[<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">ssid<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #D8DEE9FF\">]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">pw<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">secrets<\/span><span style=\"color: #D8DEE9FF\">[<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">pw<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #D8DEE9FF\">]<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">wlan<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">connect<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">ssid<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">pw<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>The onboard LED will blink three times if a WiFi connection was successful, thanks to these lines of code. It will also print a message and your IP address which can be viewed in Thonny.  This IP address is useful in order to access the server later.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"   led = machine.Pin('LED', machine.Pin.OUT)\n    for i in range(wlan.status()):\n        led.on()\n        time.sleep(0.2)\n        led.off()\n        time.sleep(0.2)\n    print('Connected')\n    status = wlan.ifconfig()\n    print('ip = ' + status[0])\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #D8DEE9\">led<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">machine<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">Pin<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">LED<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">machine<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">Pin<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">OUT<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #D8DEE9\">for<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">i<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">in<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">range<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">wlan<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">status<\/span><span style=\"color: #D8DEE9FF\">()):<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #D8DEE9\">led<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">on<\/span><span style=\"color: #D8DEE9FF\">()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #D8DEE9\">time<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">sleep<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #B48EAD\">0.2<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #D8DEE9\">led<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">off<\/span><span style=\"color: #D8DEE9FF\">()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #D8DEE9\">time<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">sleep<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #B48EAD\">0.2<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">Connected<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #D8DEE9\">status<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">wlan<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">ifconfig<\/span><span style=\"color: #D8DEE9FF\">()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">ip = <\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">+<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">status<\/span><span style=\"color: #D8DEE9FF\">[<\/span><span style=\"color: #B48EAD\">0<\/span><span style=\"color: #D8DEE9FF\">])<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>If there&#8217;s an error, the LED will blink based on the value of the error code. <\/p>\n\n\n\n<p>Error meanings<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>0 = Link Down<\/li>\n\n\n\n<li>1 = Link Join<\/li>\n\n\n\n<li>2 = Link NoIp<\/li>\n\n\n\n<li>3 = Link Up<\/li>\n\n\n\n<li>-1 = Link Fail<\/li>\n\n\n\n<li>-2 = Link NoNet<\/li>\n\n\n\n<li>-3 = Link BadAuth<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Connect Pico W to ADXL343<\/h2>\n\n\n\n<p>This line initializes an I2C object:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"# Initialize I2C\n# busio.I2C(SCL, SDA)\ni2c = busio.I2C(board.GP1, board.GP0)\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9FF\"># <\/span><span style=\"color: #D8DEE9\">Initialize<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">I2C<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\"># <\/span><span style=\"color: #D8DEE9\">busio<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">I2C<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">SCL<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">SDA<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">i2c<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">busio<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">I2C<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">board<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">GP1<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">board<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">GP0<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>Then, these two lines creates the accelerometer and enables tap detection (for dice reading).<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"# Create Accelerometer object\naccelerometer = adafruit_adxl34x.ADXL343(i2c)\n\naccelerometer.enable_tap_detection()\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9FF\"># <\/span><span style=\"color: #D8DEE9\">Create<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">Accelerometer<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">object<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">accelerometer<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">adafruit_adxl34x<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">ADXL343<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">i2c<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">accelerometer<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">enable_tap_detection<\/span><span style=\"color: #D8DEE9FF\">()<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Time to run the code<\/h2>\n\n\n\n<p>To run the code, press the Run button in Thonny, which is the button with a play icon in a green button on the top toolbar.<\/p>\n\n\n\n<p>Then, connect to the IP address of your Raspberry Pi Pico W. If you have Thonny&#8217;s shell open, you can view it there. Or else, you can log into your router and find out what the Pico W&#8217;s IP address is.<\/p>\n\n\n\n<p>The Pico W runs a HTTP server with a socket connection and it listens for connections, defined here:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"addr = socket.getaddrinfo('0.0.0.0', 80)[0][-1]\n\ns = socket.socket()\ns.bind(addr)\ns.listen(1)\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9\">addr<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">socket<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">getaddrinfo<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">0.0.0.0<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">80<\/span><span style=\"color: #D8DEE9FF\">)[<\/span><span style=\"color: #B48EAD\">0<\/span><span style=\"color: #D8DEE9FF\">][<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #B48EAD\">1<\/span><span style=\"color: #D8DEE9FF\">]<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">s<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">socket<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">socket<\/span><span style=\"color: #D8DEE9FF\">()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">s<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">bind<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">addr<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">s<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">listen<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #B48EAD\">1<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>When you connect to your Pico W&#8217;s IP address, it will trigger this code that will refresh index.html with the latest data every second.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"   cl, addr = s.accept()\n        print('Client connected from', addr)\n        cl_file = cl.makefile('rwb', 0)\n        while True:\n            line = cl_file.readline()\n            if not line or line == b'\\r\\n':\n                break\n            \n        response = get_html('index.html')\n        data = accelerometer.acceleration\n        tapped = accelerometer.events['tap']\n        response = response.replace('AccX', str(data[0]))\n        response = response.replace('AccY', str(data[1]))\n        response = response.replace('AccZ', str(data[2]))\n        if tapped:\n            dice_val = str(random.randint(1,6))\n        response = response.replace('DiceVal', dice_val)\n        \n        cl.send('HTTP\/1.0 200 OK\\r\\nContent-type: text\/html\\r\\n\\r\\n')\n        cl.send(response)\n        cl.close()\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #D8DEE9\">cl<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">addr<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">s<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">accept<\/span><span style=\"color: #D8DEE9FF\">()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #88C0D0\">print<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">Client connected from<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">addr<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #D8DEE9\">cl_file<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">cl<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">makefile<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">rwb<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">0<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #81A1C1\">while<\/span><span style=\"color: #D8DEE9FF\"> True<\/span><span style=\"color: #ECEFF4\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #D8DEE9\">line<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">cl_file<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">readline<\/span><span style=\"color: #D8DEE9FF\">()<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #81A1C1\">if<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">not<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">line<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">or<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">line<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">==<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">b<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #EBCB8B\">\\r\\n<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #D8DEE9FF\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">                <\/span><span style=\"color: #81A1C1\">break<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #D8DEE9\">response<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">get_html<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">index.html<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #D8DEE9\">data<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">accelerometer<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">acceleration<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #D8DEE9\">tapped<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">accelerometer<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">events<\/span><span style=\"color: #D8DEE9FF\">[<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">tap<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #D8DEE9FF\">]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #D8DEE9\">response<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">response<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">replace<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">AccX<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">str<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">data<\/span><span style=\"color: #D8DEE9FF\">[<\/span><span style=\"color: #B48EAD\">0<\/span><span style=\"color: #D8DEE9FF\">]))<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #D8DEE9\">response<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">response<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">replace<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">AccY<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">str<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">data<\/span><span style=\"color: #D8DEE9FF\">[<\/span><span style=\"color: #B48EAD\">1<\/span><span style=\"color: #D8DEE9FF\">]))<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #D8DEE9\">response<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">response<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">replace<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">AccZ<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">str<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">data<\/span><span style=\"color: #D8DEE9FF\">[<\/span><span style=\"color: #B48EAD\">2<\/span><span style=\"color: #D8DEE9FF\">]))<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #81A1C1\">if<\/span><span style=\"color: #D8DEE9FF\"> tapped<\/span><span style=\"color: #ECEFF4\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">            <\/span><span style=\"color: #D8DEE9\">dice_val<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">str<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">random<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">randint<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #B48EAD\">1<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #B48EAD\">6<\/span><span style=\"color: #D8DEE9FF\">))<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #D8DEE9\">response<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">response<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">replace<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">DiceVal<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">dice_val<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #D8DEE9\">cl<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">send<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">HTTP\/1.0 200 OK<\/span><span style=\"color: #EBCB8B\">\\r\\n<\/span><span style=\"color: #A3BE8C\">Content-type: text\/html<\/span><span style=\"color: #EBCB8B\">\\r\\n\\r\\n<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #D8DEE9\">cl<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">send<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">response<\/span><span style=\"color: #D8DEE9FF\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #D8DEE9\">cl<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #88C0D0\">close<\/span><span style=\"color: #D8DEE9FF\">()<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"380\" height=\"332\" src=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-14.png\" alt=\"\" class=\"wp-image-2682\" srcset=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-14.png 380w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-14-300x262.png 300w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/image-14-14x12.png 14w\" sizes=\"auto, (max-width: 380px) 100vw, 380px\" \/><figcaption class=\"wp-element-caption\">main.py replaces the values with the current reading when you connect to the Pico W&#8217;s server.<\/figcaption><\/figure>\n<\/div>\n\n\n<p>As you can see, it replaces AccX, AccY and AccZ with the data from your sensor.<\/p>\n\n\n\n<p>If the sensor is tapped, then it will print a random integer from 1 to 6 into the &#8220;DiceVal&#8221; string on the HTML page.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What&#8217;s next?<\/h2>\n\n\n\n<p>This tutorial represents one simple way to stream sensor data to a web page with your Raspberry Pi Pico W.<\/p>\n\n\n\n<p>In fact, this is the code that you can use for other sensors too.<\/p>\n\n\n\n<p>The methodology remains the same. You need to find the correct libraries for your sensors, then modify the main.py and index.html so they can get the sensor data and push the right values onto the web page.<\/p>\n\n\n\n<p>There are many other projects you can embark on, such as a temperature-and-humidity sensor or perhaps an air quality project with a DHT22 or <a href=\"https:\/\/picockpit.com\/raspberry-pi\/teach-bme688-how-to-smell\/\">BME688<\/a>, or a brightness sensor with a light resistor.<\/p>\n<div class=\"shariff shariff-align-center shariff-widget-align-left shariff-buttonstretch\"><ul class=\"shariff-buttons theme-white orientation-horizontal buttonsize-medium\"><li class=\"shariff-button twitter shariff-nocustomcolor\" style=\"background-color:#595959\"><a href=\"https:\/\/twitter.com\/share?url=https%3A%2F%2Fpicockpit.com%2Fraspberry-pi%2Fstream-sensor-data-over-wifi-with-raspberry-pi-pico-w%2F&text=Stream%20Sensor%20Data%20over%20WiFi%20with%20your%20Raspberry%20Pi%20Pico%20W\" title=\"Share on X\" aria-label=\"Share on X\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#000; color:#000\" target=\"_blank\"><span class=\"shariff-icon\" style=\"fill:#000\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 24 24\"><path fill=\"#000\" d=\"M14.258 10.152L23.176 0h-2.113l-7.747 8.813L7.133 0H0l9.352 13.328L0 23.973h2.113l8.176-9.309 6.531 9.309h7.133zm-2.895 3.293l-.949-1.328L2.875 1.56h3.246l6.086 8.523.945 1.328 7.91 11.078h-3.246zm0 0\"\/><\/svg><\/span><span class=\"shariff-text\" style=\"color:#000\">share<\/span>&nbsp;<\/a><\/li><li class=\"shariff-button facebook shariff-nocustomcolor\" style=\"background-color:#4273c8\"><a href=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fpicockpit.com%2Fraspberry-pi%2Fstream-sensor-data-over-wifi-with-raspberry-pi-pico-w%2F\" title=\"Share on Facebook\" aria-label=\"Share on Facebook\" role=\"button\" rel=\"nofollow\" class=\"shariff-link\" style=\"; background-color:#3b5998; color:#3b5998\" target=\"_blank\"><span class=\"shariff-icon\" style=\"fill:#3b5998\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 18 32\"><path fill=\"#3b5998\" d=\"M17.1 0.2v4.7h-2.8q-1.5 0-2.1 0.6t-0.5 1.9v3.4h5.2l-0.7 5.3h-4.5v13.6h-5.5v-13.6h-4.5v-5.3h4.5v-3.9q0-3.3 1.9-5.2t5-1.8q2.6 0 4.1 0.2z\"\/><\/svg><\/span><span class=\"shariff-text\" style=\"color:#3b5998\">share<\/span>&nbsp;<\/a><\/li><li class=\"shariff-button telegram shariff-nocustomcolor\" style=\"background-color:#4084A6\"><a href=\"https:\/\/telegram.me\/share\/url?url=https%3A%2F%2Fpicockpit.com%2Fraspberry-pi%2Fstream-sensor-data-over-wifi-with-raspberry-pi-pico-w%2F&text=Stream%20Sensor%20Data%20over%20WiFi%20with%20your%20Raspberry%20Pi%20Pico%20W\" title=\"Share on Telegram\" aria-label=\"Share on Telegram\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#0088cc; color:#0088cc\" target=\"_blank\"><span class=\"shariff-icon\" style=\"fill:#0088cc\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 32 32\"><path fill=\"#0088cc\" d=\"M30.8 6.5l-4.5 21.4c-.3 1.5-1.2 1.9-2.5 1.2L16.9 24l-3.3 3.2c-.4.4-.7.7-1.4.7l.5-7L25.5 9.2c.6-.5-.1-.8-.9-.3l-15.8 10L2 16.7c-1.5-.5-1.5-1.5.3-2.2L28.9 4.3c1.3-.5 2.3.3 1.9 2.2z\"\/><\/svg><\/span><span class=\"shariff-text\" style=\"color:#0088cc\">share<\/span>&nbsp;<\/a><\/li><li class=\"shariff-button reddit shariff-nocustomcolor\" style=\"background-color:#ff5700\"><a href=\"https:\/\/www.reddit.com\/submit?url=https%3A%2F%2Fpicockpit.com%2Fraspberry-pi%2Fstream-sensor-data-over-wifi-with-raspberry-pi-pico-w%2F\" title=\"Share on Reddit\" aria-label=\"Share on Reddit\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#ff4500; color:#ff4500\" target=\"_blank\"><span class=\"shariff-icon\" style=\"fill:#ff4500\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\"><path fill=\"#ff4500\" d=\"M440.3 203.5c-15 0-28.2 6.2-37.9 15.9-35.7-24.7-83.8-40.6-137.1-42.3L293 52.3l88.2 19.8c0 21.6 17.6 39.2 39.2 39.2 22 0 39.7-18.1 39.7-39.7s-17.6-39.7-39.7-39.7c-15.4 0-28.7 9.3-35.3 22l-97.4-21.6c-4.9-1.3-9.7 2.2-11 7.1L246.3 177c-52.9 2.2-100.5 18.1-136.3 42.8-9.7-10.1-23.4-16.3-38.4-16.3-55.6 0-73.8 74.6-22.9 100.1-1.8 7.9-2.6 16.3-2.6 24.7 0 83.8 94.4 151.7 210.3 151.7 116.4 0 210.8-67.9 210.8-151.7 0-8.4-.9-17.2-3.1-25.1 49.9-25.6 31.5-99.7-23.8-99.7zM129.4 308.9c0-22 17.6-39.7 39.7-39.7 21.6 0 39.2 17.6 39.2 39.7 0 21.6-17.6 39.2-39.2 39.2-22 .1-39.7-17.6-39.7-39.2zm214.3 93.5c-36.4 36.4-139.1 36.4-175.5 0-4-3.5-4-9.7 0-13.7 3.5-3.5 9.7-3.5 13.2 0 27.8 28.5 120 29 149 0 3.5-3.5 9.7-3.5 13.2 0 4.1 4 4.1 10.2.1 13.7zm-.8-54.2c-21.6 0-39.2-17.6-39.2-39.2 0-22 17.6-39.7 39.2-39.7 22 0 39.7 17.6 39.7 39.7-.1 21.5-17.7 39.2-39.7 39.2z\"\/><\/svg><\/span><span class=\"shariff-text\" style=\"color:#ff4500\">share<\/span>&nbsp;<\/a><\/li><\/ul><\/div>","protected":false},"excerpt":{"rendered":"<p>Have you ever wanted to stream sensor data with your Raspberry Pi Pico W? One of the best uses for the Raspberry Pi Pico W involves its ability to serve a web page. This means that you can use it to monitor sensor data from your phone as long as you are in WiFi range.&hellip;<\/p>\n","protected":false},"author":2,"featured_media":2687,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[582,11,221,486,447,187,579,581,580],"class_list":["post-2668","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-raspberry-pi-pico","tag-adxl343","tag-pico","tag-pico-w","tag-project","tag-projects","tag-raspberry-pi","tag-sensor-data","tag-wi-fi","tag-wifi"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Stream Sensor Data over WiFi with your Raspberry Pi Pico W | PiCockpit<\/title>\n<meta name=\"description\" content=\"A beginner&#039;s tutorial on connecting an accelerometer sensors and stream data to a web page hosted by Raspberry Pi Pico W.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/picockpit.com\/raspberry-pi\/stream-sensor-data-over-wifi-with-raspberry-pi-pico-w\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Stream Sensor Data over WiFi with your Raspberry Pi Pico W | PiCockpit\" \/>\n<meta property=\"og:description\" content=\"A beginner&#039;s tutorial on connecting an accelerometer sensors and stream data to a web page hosted by Raspberry Pi Pico W.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/picockpit.com\/raspberry-pi\/stream-sensor-data-over-wifi-with-raspberry-pi-pico-w\/\" \/>\n<meta property=\"og:site_name\" content=\"PiCockpit\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/pi3gshop\" \/>\n<meta property=\"article:published_time\" content=\"2022-07-08T09:09:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-08-28T08:44:23+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/featured-image.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"563\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"raspi berry\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pi3g\" \/>\n<meta name=\"twitter:site\" content=\"@pi3g\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"raspi berry\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/zh\\\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/zh\\\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\\\/\"},\"author\":{\"name\":\"raspi berry\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#\\\/schema\\\/person\\\/7af3a7a8c999bc722029ef9ca9d78eee\"},\"headline\":\"Stream Sensor Data over WiFi with your Raspberry Pi Pico W\",\"datePublished\":\"2022-07-08T09:09:10+00:00\",\"dateModified\":\"2023-08-28T08:44:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/zh\\\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\\\/\"},\"wordCount\":1005,\"commentCount\":7,\"publisher\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/zh\\\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/featured-image.jpg\",\"keywords\":[\"ADXL343\",\"Pico\",\"Pico W\",\"project\",\"Projects\",\"Raspberry Pi\",\"sensor data\",\"Wi-Fi\",\"WiFi\"],\"articleSection\":[\"Raspberry Pi Pico\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/zh\\\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/zh\\\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\\\/\",\"url\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/zh\\\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\\\/\",\"name\":\"Stream Sensor Data over WiFi with your Raspberry Pi Pico W | PiCockpit\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/zh\\\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/zh\\\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/featured-image.jpg\",\"datePublished\":\"2022-07-08T09:09:10+00:00\",\"dateModified\":\"2023-08-28T08:44:23+00:00\",\"description\":\"A beginner's tutorial on connecting an accelerometer sensors and stream data to a web page hosted by Raspberry Pi Pico W.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/zh\\\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/zh\\\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/zh\\\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\\\/#primaryimage\",\"url\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/featured-image.jpg\",\"contentUrl\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/featured-image.jpg\",\"width\":1000,\"height\":563,\"caption\":\"Raspberry Pi Pico W tutorial stream sensor data\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/zh\\\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Raspberry Pi Pico\",\"item\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/category\\\/raspberry-pi-pico\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Stream Sensor Data over WiFi with your Raspberry Pi Pico W\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#website\",\"url\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/\",\"name\":\"PiCockpit\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#organization\",\"name\":\"PiCockpit.com\",\"url\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/wp-content\\\/uploads\\\/2023\\\/07\\\/Screenshot-from-2023-07-24-15-01-24.png\",\"contentUrl\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/wp-content\\\/uploads\\\/2023\\\/07\\\/Screenshot-from-2023-07-24-15-01-24.png\",\"width\":1165,\"height\":283,\"caption\":\"PiCockpit.com\"},\"image\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/pi3gshop\",\"https:\\\/\\\/x.com\\\/pi3g\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#\\\/schema\\\/person\\\/7af3a7a8c999bc722029ef9ca9d78eee\",\"name\":\"raspi berry\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c10c423ceeff34163dd54a5472d6da17d71c0e360e0cf8cdb8847006372f216b?s=96&d=blank&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c10c423ceeff34163dd54a5472d6da17d71c0e360e0cf8cdb8847006372f216b?s=96&d=blank&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c10c423ceeff34163dd54a5472d6da17d71c0e360e0cf8cdb8847006372f216b?s=96&d=blank&r=g\",\"caption\":\"raspi berry\"},\"description\":\"I'm here to help you with all your Raspberry Pi related questions &amp; love to share about new project ideas for the Raspberry Pi, and give quick tips. Of course I'll also help you with PiCockpit and how to make your Raspberry Pi even easier to use with this raspberry pi monitoring solution :-)\",\"sameAs\":[\"https:\\\/\\\/picockpit.com\"],\"url\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/author\\\/raspi-berry\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Stream Sensor Data over WiFi with your Raspberry Pi Pico W | PiCockpit","description":"A beginner's tutorial on connecting an accelerometer sensors and stream data to a web page hosted by Raspberry Pi Pico W.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/picockpit.com\/raspberry-pi\/stream-sensor-data-over-wifi-with-raspberry-pi-pico-w\/","og_locale":"en_US","og_type":"article","og_title":"Stream Sensor Data over WiFi with your Raspberry Pi Pico W | PiCockpit","og_description":"A beginner's tutorial on connecting an accelerometer sensors and stream data to a web page hosted by Raspberry Pi Pico W.","og_url":"https:\/\/picockpit.com\/raspberry-pi\/stream-sensor-data-over-wifi-with-raspberry-pi-pico-w\/","og_site_name":"PiCockpit","article_publisher":"https:\/\/www.facebook.com\/pi3gshop","article_published_time":"2022-07-08T09:09:10+00:00","article_modified_time":"2023-08-28T08:44:23+00:00","og_image":[{"width":1000,"height":563,"url":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/featured-image.jpg","type":"image\/jpeg"}],"author":"raspi berry","twitter_card":"summary_large_image","twitter_creator":"@pi3g","twitter_site":"@pi3g","twitter_misc":{"Written by":"raspi berry","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/picockpit.com\/raspberry-pi\/zh\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\/#article","isPartOf":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/zh\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\/"},"author":{"name":"raspi berry","@id":"https:\/\/picockpit.com\/raspberry-pi\/#\/schema\/person\/7af3a7a8c999bc722029ef9ca9d78eee"},"headline":"Stream Sensor Data over WiFi with your Raspberry Pi Pico W","datePublished":"2022-07-08T09:09:10+00:00","dateModified":"2023-08-28T08:44:23+00:00","mainEntityOfPage":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/zh\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\/"},"wordCount":1005,"commentCount":7,"publisher":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/#organization"},"image":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/zh\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\/#primaryimage"},"thumbnailUrl":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/featured-image.jpg","keywords":["ADXL343","Pico","Pico W","project","Projects","Raspberry Pi","sensor data","Wi-Fi","WiFi"],"articleSection":["Raspberry Pi Pico"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/picockpit.com\/raspberry-pi\/zh\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/picockpit.com\/raspberry-pi\/zh\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\/","url":"https:\/\/picockpit.com\/raspberry-pi\/zh\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\/","name":"Stream Sensor Data over WiFi with your Raspberry Pi Pico W | PiCockpit","isPartOf":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/#website"},"primaryImageOfPage":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/zh\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\/#primaryimage"},"image":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/zh\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\/#primaryimage"},"thumbnailUrl":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/featured-image.jpg","datePublished":"2022-07-08T09:09:10+00:00","dateModified":"2023-08-28T08:44:23+00:00","description":"A beginner's tutorial on connecting an accelerometer sensors and stream data to a web page hosted by Raspberry Pi Pico W.","breadcrumb":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/zh\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/picockpit.com\/raspberry-pi\/zh\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/picockpit.com\/raspberry-pi\/zh\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\/#primaryimage","url":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/featured-image.jpg","contentUrl":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2022\/07\/featured-image.jpg","width":1000,"height":563,"caption":"Raspberry Pi Pico W tutorial stream sensor data"},{"@type":"BreadcrumbList","@id":"https:\/\/picockpit.com\/raspberry-pi\/zh\/%e7%94%a8%e6%a0%91%e8%8e%93-pi-pico-w%e9%80%9a%e8%bf%87wifi%e4%bc%a0%e8%be%93%e4%bc%a0%e6%84%9f%e5%99%a8%e6%95%b0%e6%8d%ae%e6%b5%81\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/picockpit.com\/raspberry-pi\/"},{"@type":"ListItem","position":2,"name":"Raspberry Pi Pico","item":"https:\/\/picockpit.com\/raspberry-pi\/category\/raspberry-pi-pico\/"},{"@type":"ListItem","position":3,"name":"Stream Sensor Data over WiFi with your Raspberry Pi Pico W"}]},{"@type":"WebSite","@id":"https:\/\/picockpit.com\/raspberry-pi\/#website","url":"https:\/\/picockpit.com\/raspberry-pi\/","name":"PiCockpit","description":"","publisher":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/picockpit.com\/raspberry-pi\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/picockpit.com\/raspberry-pi\/#organization","name":"PiCockpit.com","url":"https:\/\/picockpit.com\/raspberry-pi\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/picockpit.com\/raspberry-pi\/#\/schema\/logo\/image\/","url":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2023\/07\/Screenshot-from-2023-07-24-15-01-24.png","contentUrl":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2023\/07\/Screenshot-from-2023-07-24-15-01-24.png","width":1165,"height":283,"caption":"PiCockpit.com"},"image":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/pi3gshop","https:\/\/x.com\/pi3g"]},{"@type":"Person","@id":"https:\/\/picockpit.com\/raspberry-pi\/#\/schema\/person\/7af3a7a8c999bc722029ef9ca9d78eee","name":"raspi berry","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c10c423ceeff34163dd54a5472d6da17d71c0e360e0cf8cdb8847006372f216b?s=96&d=blank&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c10c423ceeff34163dd54a5472d6da17d71c0e360e0cf8cdb8847006372f216b?s=96&d=blank&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c10c423ceeff34163dd54a5472d6da17d71c0e360e0cf8cdb8847006372f216b?s=96&d=blank&r=g","caption":"raspi berry"},"description":"I'm here to help you with all your Raspberry Pi related questions &amp; love to share about new project ideas for the Raspberry Pi, and give quick tips. Of course I'll also help you with PiCockpit and how to make your Raspberry Pi even easier to use with this raspberry pi monitoring solution :-)","sameAs":["https:\/\/picockpit.com"],"url":"https:\/\/picockpit.com\/raspberry-pi\/author\/raspi-berry\/"}]}},"_links":{"self":[{"href":"https:\/\/picockpit.com\/raspberry-pi\/wp-json\/wp\/v2\/posts\/2668","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/picockpit.com\/raspberry-pi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/picockpit.com\/raspberry-pi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/picockpit.com\/raspberry-pi\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/picockpit.com\/raspberry-pi\/wp-json\/wp\/v2\/comments?post=2668"}],"version-history":[{"count":15,"href":"https:\/\/picockpit.com\/raspberry-pi\/wp-json\/wp\/v2\/posts\/2668\/revisions"}],"predecessor-version":[{"id":4960,"href":"https:\/\/picockpit.com\/raspberry-pi\/wp-json\/wp\/v2\/posts\/2668\/revisions\/4960"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/picockpit.com\/raspberry-pi\/wp-json\/wp\/v2\/media\/2687"}],"wp:attachment":[{"href":"https:\/\/picockpit.com\/raspberry-pi\/wp-json\/wp\/v2\/media?parent=2668"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/picockpit.com\/raspberry-pi\/wp-json\/wp\/v2\/categories?post=2668"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/picockpit.com\/raspberry-pi\/wp-json\/wp\/v2\/tags?post=2668"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}