===== Setting up the microcontrollers =====
To test the microcontrollers, open up [[https://thonny.org/|Thonny]] and use the hamburger menu in the bottom right menu to select ''MicroPython (ESP32)'' while the board is plugged in. If it doesn't bring up a REPL prompt, you'll need to install MicroPython on the unit
==== Installing Micropython ====
A tutorial for installing MicroPython is available at the [[https://micropython.org/download/ESP32_GENERIC_C3/| MicroPython website]]. Thonny will tell you what port the device is connected on, but you'll need to close it before you use the ''ESPTool'' program. You can run both commands at the same time via the following:
esptool erase_flash & esptool –baud 460800 write_flash 0 ESP32_GENERIC_C3-20250911-v1.26.1.bin
==== Uploding Code ====
Plug the device in, and connect to it via Thonny. Use the ''View'' tab to check the ''Files'' option. Copy the ''main.py'' file to the device, create (and enter) a ''lib'' folder on it, and then upload ''functools.py'' to the folder. Connect the sensor and run the ''main.py'' code to check if it works, it should output a message saying ''addresses found:0x10'' and then start streaming data.
{{phylabs:lab_courses:phys-120_130-wiki-home:spring-experiments:new_polarization:main.py}}
{{phylabs:lab_courses:phys-120_130-wiki-home:spring-experiments:new_polarization:functools.py}}
===== Setting up PCs =====
Computers will need to have ''tkintertable'' and ''pyserial-py'' packages installed. The rest should be part of a default anaconda install.
Setting up the default for the ''.py'' extension to ''C:\Program Data\Anaconda3\python.exe'' is also needed.