// Cambridge, MA

week 3: embedded programming

this week, my task was to write a program for a microcontroller development board to interact with local I/O and communicate remotely.
i chose to work with the SEEED XIAO Rp2040, as the guides suggested it was best for a beginner, which i am. the first step was simply to plug the device in to my computer. doing so yielded an interesting result--upon entering the bootloader, the devices showed up as a USB drive in my file management system.

next, i had to configure the board. i did this with the help of quentin at office hours, he recommended using this very helpful board manager. after downloading arduino, i selected the RP2040 as my board, but when i went to select its port, i learned that apparently my laptop, which has 4 visible usb ports, actually has far more ports than i realized:

i found the right port by unplugging the board and discovering which port option had gone away. in terms of programming the board, i consulted the wiki, which had a very handy schematic.

i wanted to make one of the colored LEDs flash. in order to do so, i used the schematic to learn that this LED output was attached to I/O pin 25. so, i wrote the following code in arduino to make the board flash at 5 Hz:
i flashed the code to the board, and it worked!
next up was to make it communicate remotely, so i wrote a simple function to write a "hello" message to the serial monitor. this also woked well, and i also modified the code to treat the pin number as a #define.
this week was very interesting. i had never worked with microcontrollers, and although the output is very simple, it's an excitingly foundational thing to learn. i'm going to dive in to micropython tonight and more advanced applications as i have time.