Shellminator V3.0.1
Simple Terminal
|
This is an exciting example where we demonstrate how to dynamically update a plot in real time.
In this case, we've implemented a capacitor charging simulator that calculates the ideal capacitor voltage over time.
Every 2 seconds, the capacitor voltage is recalculated and added to the plot.
To keep the simulation real-time, we use the millis()
function. So, if you were to build this circuit in real life and measure the capacitor voltage with an ADC, you’d see the exact same behavior.
Let's give our plot a distinctive color:
We define a timer to control how often new values are calculated:
Whenever you update the plot data, you must call:
Without this, the changes won't appear on the screen.
Since redrawing the plot is resource-intensive, it's best not to update it too frequently**—every **few seconds is ideal.
This means Shellminator isn’t suited for oscilloscope-level speeds, but it works great for visualizing slower processes.