Hi @esavkin, currently I want to figure out why the voltages I get with get_adc() gives me values in-between -10V to 10 V, and so I was hoping that would not involve the Urukul board yet. For now, I have found a workaround that gives me readings that reflects the signal from the function generator. I've added conditional statements, where if the value from get_adc() is above or below 5, I would subtract or add 10, respectively. So the new code looks like this:
def run(self):
self.core.reset()
self.core.break_realtime()
self.suservo0.init()
self.suservo0.set_pgia_mu(self.channeln, self.input_gain)
self.suservo0.set_config(enable=1)
n_samples = 100
self.set_dataset("samples", np.full(n_samples, np.nan), broadcast=True)
for j in range(n_samples):
self.suservo0.set_config(enable=0)
delay(10 * us)
val = self.suservo0.get_adc(0)
if val > 5: # If statements are the workaround for +/- 5 V
val = val - 10
elif val < -5:
val = val + 10
self.mutate_dataset("samples", j, val)
delay(50 * ms)
self.suservo0.get_status()
delay(10 * us)
self.suservo0.set_config(enable=1)
delay(20 * ms)
With this code, I get a plot that mirrors the input from the function generator (settings of 1V peak to peak, 0V offset):

Versus if I did not add the workaround, then my plot would look like this:

(The Y axis is Voltage, and X is samples for both graphs.) I'm wondering why I have to implement this workaround to get a plot that mirrors the input. But also, where are the values of (10V + input) and (-10 V + input) as shown in the second graph coming from?
Thanks.