Hello,
I got saadc example on my nrf5340 dk running and now I would like to plot the incoming serial data.
saadc code example: saadc.zip
changed the way I got adviced in nrfx_saadc - buildconf. error PPI_CHEN / DPPIC_CHEN / nrfx_saadc---buildconf-error-ppi_chen-dppic_chen
My approach is using matplotlib from python and already got code running and some plot in real time.
#https://code.visualstudio.com/docs/python/python-tutorial #https://learn.sparkfun.com/tutorials/graph-sensor-data-with-python-and-matplotlib/update-a-graph-in-real-time import datetime as dt import matplotlib.pyplot as plt import matplotlib.animation as animation import numpy as np # Create figure for plotting fig = plt.figure() ax = fig.add_subplot(1, 1, 1) xs = [] ys = [] # This function is called periodically from FuncAnimation def animate(i, xs, ys): # Add x and y to lists xs.append(dt.datetime.now().strftime('%H:%M:%S.%f')) ys.append(20) #straightforward plotting value 20 # Limit x and y lists to 20 items xs = xs[-20:] ys = ys[-20:] # Draw x and y lists ax.clear() ax.plot(xs, ys) # Format plot plt.xticks(rotation=45, ha='right') plt.subplots_adjust(bottom=0.30) plt.title('Graph in real time') plt.ylabel('int') # Set up plot to call animate() function periodically ani = animation.FuncAnimation(fig, animate, fargs=(xs, ys), interval=100) plt.show()
Now I am plotting value 20 all the time and would appreciate any help how to get the ADC value from main.c to python file for plotting task. Is it even possible or any workaround?
Many many thanks in advance,
Christoph