First Commit

This commit is contained in:
MindCreeper03
2025-02-27 19:31:50 +01:00
parent bcbb6aff9a
commit e490df1715
2470 changed files with 1479965 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
from serial import Serial
import time
ser = Serial()
def getPortName() -> str:
return "COM"+input("Enter the number of the connected Port: ")
def getBaudRate() -> int:
return int(input("Enter the Baudrate you are using"))
def getTimeStamp() -> str:
current_time = time.strftime("%y%m%d%w%H%M%S")+"x" #YYMMDDwHHMMSS
print("Getting current Time")
return current_time
def main():
ser.port = getPortName()
if input("Are you using 57600 as baud rate ? (y/N)").lower() == "y":
ser.baudrate = 57600
else:
ser.baudrate = getBaudRate()
timestamp =getTimeStamp()
print(f"Opening port {ser.port} at baudrate {ser.baudrate}")
ser.open()
print("Sending current time to Port")
print(timestamp)
ser.write(timestamp.encode())
print("Closing Port")
ser.close()
if __name__ == "__main__":
main()