Initial Commit

This commit is contained in:
janis
2022-05-14 18:04:52 +02:00
commit 3fade3a2c9
20 changed files with 587 additions and 0 deletions

26
bin/others/run_command.py Normal file
View File

@@ -0,0 +1,26 @@
import serial
import bin.com.csv_parsers
import bin.com.lib
cvr = bin.com.csv_parsers.CsvRead()
com = bin.com.lib.Com()
class RunCommand:
def __init__(self):
self.__all_commands = []
self.__return = ""
def runcommand(self, command, command_list_path):
self.__all_commands = cvr.importing(command_list_path).pop(0)
if command in self.__all_commands:
try:
com.connect(19200, "")
com.send(command)
self.__return = "The command executed successfully"
except serial.SerialException:
self.__return = f"[micro:bit - {command}]: An error occurred running the command. (Maybe disconnected or no permission?)"
else:
self.__return = "-micro:bit - No such command"
return self.__return