mirror of
https://gitlab.com/Luci_/arduino-photometrics.git
synced 2026-04-03 03:25:36 +02:00
13 lines
325 B
Python
Executable file
13 lines
325 B
Python
Executable file
import serial
|
||
import time
|
||
|
||
# Remplace par ton port Arduino
|
||
ser = serial.Serial('/dev/ttyACM0', 9600)
|
||
time.sleep(2) # attendre que l’Arduino 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}")
|