Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setPenUpRate(port_name, pen_up_rate):
if port_name is not None:
ebb_serial.command(port_name, 'SC,11,{0}\r'.format(pen_up_rate))
# Set the rate of change of the servo when going up.
def setEBBLV(port_name, ebb_lv):
# Set the EBB "Layer" Variable, an 8-bit number we can read and write.
# (Unrelated to our plot layers; name is an historical artifact.)
if port_name is not None:
ebb_serial.command(port_name, 'SL,{0}\r'.format(ebb_lv))
def setPenDownRate(port_name, pen_down_rate):
if port_name is not None:
ebb_serial.command(port_name, 'SC,12,{0}\r'.format(pen_down_rate))
# Set the rate of change of the servo when going down.
def setPenUpPos(port_name, servo_min):
if port_name is not None:
ebb_serial.command(port_name, 'SC,4,{0}\r'.format(servo_min))
# servo_min may be in the range 1 to 65535, in units of 83 ns intervals. This sets the "Pen Up" position.
def PBOutValue(port_name, pin, state):
# Set state of the I/O pin. Pin: {0,1,2, or 3}. State: {0 or 1}.
# Set the pin as an output with OutputPinBConfigure before using this.
if port_name is not None:
str_output = 'PO,B,{0},{1}\r'.format(pin, state)
ebb_serial.command(port_name, str_output)
def TogglePen(port_name):
if port_name is not None:
ebb_serial.command(port_name, 'TP\r')
def sendPenDown(port_name, pen_delay):
if port_name is not None:
str_output = 'SP,0,{0}\r'.format(pen_delay)
ebb_serial.command(port_name, str_output)
def doXYMove(port_name, delta_x, delta_y, duration):
# Move X/Y axes as: "SM,,,"
# Typically, this is wired up such that axis 1 is the Y axis and axis 2 is the X axis of motion.
# On EggBot, Axis 1 is the "pen" motor, and Axis 2 is the "egg" motor.
if port_name is not None:
str_output = 'SM,{0},{1},{2}\r'.format(duration,delta_y,delta_x)
ebb_serial.command(port_name, str_output)