yhur / arduplot

MIT License
41 stars 7 forks source link

Add plotter sample period #16

Closed ancebfer closed 11 months ago

ancebfer commented 11 months ago

Adds plotter sample period command line argument to allow real time wave representations.

For example, 1 Hz sine wave generator with 10 ms sample period running in ESP32:

import math
import utime

freq = 1  # Hz
period = 0.01  # s

t = 0
while True:
    x = math.sin(2 * math.pi * freq * t)
    print(x)
    t += period
    utime.sleep(period)

Can be plotted in real time with:

arduplot -p /dev/ttyUSB0 -w 500 -e 10

wave