博文

目前显示的是标签为“SAMD21”的博文

How to find model of microcontroller for Arduino IDE?

图片
 In Arduino -land, the “ microcontroller model” is usually determined by which Board (and sometimes Processor) you select in the IDE. If you don’t know what chip is on the board, there are a few reliable ways to find it. 1) The fastest: check Tools → Board (and Tools → Processor ) Connect the board. In Arduino IDE: Tools → Board : pick (or confirm) the board family (Uno, Nano, Mega, ESP32 Dev Module, Pico, etc.) Tools → Processor (only appears for some AVR boards like Nano/Pro Mini): this often directly shows the MCU choice, e.g. ATmega328P vs ATmega168 . If you see a “Processor” submenu, that’s basically your answer. 2) Arduino IDE 2.x: Tools → Get Board Info With the board plugged in and the correct Tools → Port selected: Tools → Get Board Info shows things like board name , VID/PID , and sometimes the identified board profile. This won’t always print the exact MCU model, but it helps you confirm the board family so you can map it to the MCU. 3...

How to debug Arduino Nano 33 IoT code?

图片
The Arduino Nano 33 IoT ( ATSAMD21G18 , 3.3 V) is great for “real” debugging. Here’s a focused playbook just for this board. 1) Quick wins (native USB board) Select the right core/board: Boards Manager → Arduino SAMD Boards → Arduino Nano 33 IoT . USB gotcha: a bad sketch can “hide” the port. Double-tap RESET → bootloader mode (LED pulsing) → upload again. Serial init (with timeout): void setup () { Serial. begin ( 115200 ); unsigned long t0 = millis (); while (!Serial && ( millis ()-t0 < 1500 )) { } // don't hang forever Serial. println ( "Hello from Nano 33 IoT" ); } 3.3 V only. Don’t feed 5 V signals into pins. 2) Print-style debugging (fastest) Use Serial.print/println liberally. For periodic sanity: static uint32_t last; if ( millis () - last > 1000 ) { last = millis (); Serial. printf ( "t=%lu\n" , millis ()); } On SAMD, Serial is the USB CDC port; Serial1 is on D0/D1 if you need an extern...