by Guest » 07 Jan 2025, 04:35
Siehe im Anhang meine Eingangswellenform zum Kanal von ADS1115, meinen Code und meine Ausgabe, die ich erhalte.
Ich kann die Matplotlib-Ausgangswellenform nicht so reibungslos zeichnen wie meine Eingangswellenform Oszilloskop
Die Eingangsfrequenz beträgt 50 Hz
Code -
Code: Select all
import matplotlib.pyplot as plt
import adafruit_ads1x15.ads1115 as ADS
from adafruit_ads1x15.analog_in import AnalogIn
import board
import busio
import numpy as np
import time
i2c = busio.I2C(board.SCL, board.SDA)
ads = ADS.ADS1115(i2c,gain=1,data_rate=860)
ads.data_rate=860
Channel0 = AnalogIn(ads, ADS.P0)
times = []
voltages = []
start_time = time.time()
while True:
current_time = time.time() - start_time
voltage0 = Channel0.voltage
times.append(current_time)
voltages.append(voltage0)
plt.clf()
plt.plot(times, voltages)
plt.xlabel('Time (s)')
plt.ylabel('Channel Voltage (V)')
plt.title('Voltage over Time')
plt.pause(0.005)
Dies ist die Eingangswellenform:
Das bekomme ich:
[img]https:// i.sstatic.net/tlqRu4yf.jpg[/img]
Ich habe erwartet, dass die Ausgangswellenform immer noch die gleiche sinusförmige Ausgabe hat.
Siehe im Anhang meine Eingangswellenform zum Kanal von ADS1115, meinen Code und meine Ausgabe, die ich erhalte.
Ich kann die Matplotlib-Ausgangswellenform nicht so reibungslos zeichnen wie meine Eingangswellenform Oszilloskop
Die Eingangsfrequenz beträgt 50 Hz
Code -
[code]import matplotlib.pyplot as plt
import adafruit_ads1x15.ads1115 as ADS
from adafruit_ads1x15.analog_in import AnalogIn
import board
import busio
import numpy as np
import time
i2c = busio.I2C(board.SCL, board.SDA)
ads = ADS.ADS1115(i2c,gain=1,data_rate=860)
ads.data_rate=860
Channel0 = AnalogIn(ads, ADS.P0)
times = []
voltages = []
start_time = time.time()
while True:
current_time = time.time() - start_time
voltage0 = Channel0.voltage
times.append(current_time)
voltages.append(voltage0)
plt.clf()
plt.plot(times, voltages)
plt.xlabel('Time (s)')
plt.ylabel('Channel Voltage (V)')
plt.title('Voltage over Time')
plt.pause(0.005)
[/code]
Dies ist die Eingangswellenform:
[img]https://i.sstatic.net/HNK3LTOy .png[/img]
Das bekomme ich:
[img]https:// i.sstatic.net/tlqRu4yf.jpg[/img]
Ich habe erwartet, dass die Ausgangswellenform immer noch die gleiche sinusförmige Ausgabe hat.