Provide data from .c file to .py file VS Code - matplotlib.pyplot

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.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#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
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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