online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
import re SN_REGEX = re.compile(r"^(?P<sn>^CZP.{16})$") def sn_gcode(sn): """Return Gcodes needed for flashing `sn` into eeprom""" first = "X"+("".join([hex(letter)[2:] for letter in sn.encode("ascii")])+"00")[:32] last = "X"+("".join([hex(letter)[2:] for letter in sn.encode("ascii")])+"00")[32:] return "D3 Ax0d15 C16 %s" % first, "D3 Ax0d25 C4 %s" % last success = False while not success: sn = input("Enter your serial number: ") if not SN_REGEX.match(sn): print("Invalid. The serial number should start with CZPX followed by 16 characters. More at: ") else: success = True gcodes = sn_gcode(sn) print("Open a serial console to your printer using minicom, screen, octoprint pronterface or putty and enter these two commands") print(gcodes[0]) print(gcodes[1]) print() print("Use the \"PRUSA SN\" command to ensure your serial number got stored")

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue