arduino-photometrics/exec/time.py
2025-12-02 13:58:30 +01:00

13 lines
325 B
Python
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import serial
import time
# Remplace par ton port Arduino
ser = serial.Serial('/dev/ttyACM0', 9600)
time.sleep(2) # attendre que lArduino démarre
epoch = int(time.time()) # secondes depuis 1970
ser.write(f"{epoch}\n".encode()) # envoie sous forme texte, terminé par \n
ser.close()
print(f"Envoyé epoch: {epoch}")