These scripts are used for the lab practical for constructing a photometer. The PySerial library is required for this script.
The take_measurement.py script reads serial data sent to the computer from the Arduino. The script will need the interface variable editing to reflect the hardware setup of the specific computer (see below for information about determining hardware interfaces).
Take Measurement Script (Python) ↓
The arduino_photometer.ino is an Arduino script which runs on the Arduino, configuring the device to send serial data from pin A0 to the computer.
Arduino Photometer Script (Arduino Sketch) ↓
To determine the hardware interface being used by the Arduino, the following python command can be run:
python -m serial.tools.list_ports -v