If you use micropython, you can simple run this in Shell (I am using Thorny to communicate with Pico):the code is on C, I am not getting there yet.
If somebody likes, this is my code on Arduino:
C-like:#include "pico/unique_id.h" String cadena; void setup() { // put your setup code here, to run once: Serial.begin(115200); while (!Serial) { ; // wait for serial port to connect. Needed for native USB port only } // send an intro: Serial.println("\n\nPico Unique Board ID:"); Serial.println(); } void loop() { pico_unique_board_id_t board_id; pico_get_unique_board_id(&board_id); //pico_get_unique_board_id_string; cadena = ""; for (int i = 0; i < PICO_UNIQUE_BOARD_ID_SIZE_BYTES; ++i) { // Serial.write(board_id.id[i]); //Serial.write(13); //Serial.write(10); cadena += board_id.id[i]; } Serial.println(cadena); delay(5000); }
I am using Raspberry Pi Pico/RP2040 https://github.com/earlephilhower/arduino-pico board library on the Arduino IDE, that have the unique_id.h file.
Code:
>>> import ubinascii
>>> import machine
>>> ubinascii.hexlify(machine.unique_id())
Last edited by marhalloweenvt,