Using an Arduino with Python LESSON 5: Analog Voltage Meter in vPython

In this lesson we begin coding a 3D analog voltmeter model in vPython. We begin by connecting a potentiometer to an arduino to create a voltage divider. The voltage is read from the center tap of the potentiometer by the arduino, and then the arduino passes the data to python. Then, we animate the  analog voltmeter based on the readings passed from the Arduino. Enjoy!

Then this is the code we developed for the Python side.