Getting Pico Serial Number, sharing Pico data in sensor.community

I managed to get the serial number through VS Code and through this C code.

  1. When I changed the USB hub to another USB cable I started getting the serial number in VS Code when flashing it onto Pico (1st screenshot). It must have been bad connection previously through the hub.

Now when I run this command, I get the desired dev/cu.usbmodem thingy:

$ sudo ls -la /dev/cu.*
Password:
crw-rw-rw-  1 root  wheel  0x16000001 10 Aug 12:42 /dev/cu.BLTH
crw-rw-rw-  1 root  wheel  0x16000003 10 Aug 12:54 /dev/cu.usbmodem14301
  1. When I changed in Thonny > bottom right corner > the WebREPL setting from “try to detect port automatically” to “n/a /dev/cu.BLTH” (2nd screenshot) then I could not get the flashed onto Pico code to run and show results in Thonny (3rd screenshot). But when I changed it to manually choose /dev/cu.usbmodem14301, the code started running (4th screenshot)! It does it in a weird way, displaying error that the device is busy, but hey - it works!

Conclusion: you don’t need to write the code to get serial number from Pico. You need a simple, runnable, hello world C program and serial number will print in VS Code when you try to run it on Pico.