Files
pybricks-api/examples/ev3/datalog_extra/main.py
T
Laurens Valk adf8ed6b56 pybricks.hubs: Enable EV3.
First pass including Image and ImageFile. Largely migrated from old ev3dev version. We can refine this for the embedded version in the next commits.
2026-08-25 11:42:05 +02:00

15 lines
542 B
Python

from pybricks.parameters import Color
from pybricks.tools import DataLog
# Create a data log file called my_file.txt
data = DataLog("time", "angle", name="my_file", timestamp=False, extension="txt")
# The log method uses the print() method to add a line of text.
# So, you can do much more than saving numbers. For example:
data.log("Temperature", 25)
data.log("Sunday", "Monday", "Tuesday")
data.log({"Kiwi": Color.GREEN}, {"Banana": Color.YELLOW})
# You can upload the file to your computer, but you can also print the data:
print(data)