Amplifier Chain example script (arduino.py) Prints the amplifier's gain and offset, then once a second the sensor's voltage read directly on A1, the same worked out from the amplifier's output, the amplifier's output (also on J8 pin 4) and the divided signal on A3.
- Connect
- JP4 on 5 V, JP1 on INT and JP2 on EXT. A meter on J8 pin 4 should match the opamp column.
- Uses
- raw_sensor_volts(), sensor_volts(), amplifier_volts(), output_volts(), amplifier_gain(), amplifier_offset_volts()
from arduino import *
import analog_shield as shield
def setup():
print("gain %.3f, offset %.3f V" % (shield.amplifier_gain(), shield.amplifier_offset_volts()))
print("A1 sensor opamp A3")
def loop():
print("%.3f %.3f %.3f %.3f" % (
shield.raw_sensor_volts(),
shield.sensor_volts(),
shield.amplifier_volts(),
shield.output_volts(),
))
delay(1000)
def main():
setup()
while True:
loop()
if __name__ == "__main__":
main()