arduino-2020-07-01-0009.py
01234567890123456789012345678901234567890123456789012345678901234567890123456789









705706707708709710711712713714715716717718719720721722723724725  726727728729730731732733734735736737738739    740741742743744745746747748749750751752753754755756757758759











                            <----SKIPPED LINES---->





  message_dict = GenerateServoMessage(laser=LASER_ALL, angles=(0, 0))
  link.Write(DictToValueTuple(message_dict, write_keys, write_format_tuple))
  time.sleep(1)

  message_dict = GenerateServoMessage(laser=LASER_RED, angles=(90, 0))
  link.Write(DictToValueTuple(message_dict, write_keys, write_format_tuple))
  time.sleep(1)

  message_dict = GenerateServoMessage(laser=LASER_GREEN, angles=(180, 0))
  link.Write(DictToValueTuple(message_dict, write_keys, write_format_tuple))
  time.sleep(1)

  message_dict = GenerateServoMessage(laser=LASER_BLUE, angles=(270, 0))
  link.Write(DictToValueTuple(message_dict, write_keys, write_format_tuple))
  time.sleep(1)


def ServoTestLED(link, write_keys, write_format_tuple):
  """Cycle thru the LED colors."""
  message_dict = GenerateServoMessage(led=(MAX_PWM, MAX_PWM, MAX_PWM))


  link.Write(DictToValueTuple(message_dict, write_keys, write_format_tuple))
  time.sleep(1)

  message_dict = GenerateServoMessage(led=(MAX_PWM, 0, 0))
  link.Write(DictToValueTuple(message_dict, write_keys, write_format_tuple))
  time.sleep(1)

  message_dict = GenerateServoMessage(led=(0, MAX_PWM, 0))
  link.Write(DictToValueTuple(message_dict, write_keys, write_format_tuple))
  time.sleep(1)

  message_dict = GenerateServoMessage(led=(0, 0, MAX_PWM))
  link.Write(DictToValueTuple(message_dict, write_keys, write_format_tuple))
  time.sleep(1)






def ServoTestSweep(link, write_keys, write_format_tuple, altitude=45):
  """Sweep red laser around 360 degrees."""
  for azimuth in range(0, 360, 10):

    message_dict = GenerateServoMessage(
        laser=LASER_RED, angles=(azimuth, altitude))
    link.Write(DictToValueTuple(message_dict, write_keys, write_format_tuple))

    time.sleep(WRITE_DELAY_TIME)


last_angles = (0, 0)
last_laser = LASER_OFF
last_led = LED_OFF
def GenerateServoMessage(
    angles=None,
    laser=None,
    led=None,




                            <----SKIPPED LINES---->





01234567890123456789012345678901234567890123456789012345678901234567890123456789









705706707708709710711712713714715716717718719720721722723724725726727728729730731  732733734 735736737738739740741742743744745746747748749750751752753754755756757758759760761762











                            <----SKIPPED LINES---->





  message_dict = GenerateServoMessage(laser=LASER_ALL, angles=(0, 0))
  link.Write(DictToValueTuple(message_dict, write_keys, write_format_tuple))
  time.sleep(1)

  message_dict = GenerateServoMessage(laser=LASER_RED, angles=(90, 0))
  link.Write(DictToValueTuple(message_dict, write_keys, write_format_tuple))
  time.sleep(1)

  message_dict = GenerateServoMessage(laser=LASER_GREEN, angles=(180, 0))
  link.Write(DictToValueTuple(message_dict, write_keys, write_format_tuple))
  time.sleep(1)

  message_dict = GenerateServoMessage(laser=LASER_BLUE, angles=(270, 0))
  link.Write(DictToValueTuple(message_dict, write_keys, write_format_tuple))
  time.sleep(1)


def ServoTestLED(link, write_keys, write_format_tuple):
  """Cycle thru the LED colors."""

  def SendLEDMessage(red, green, blue):
    message_dict = GenerateServoMessage(led=(int(red), int(green), int(blue)))
    link.Write(DictToValueTuple(message_dict, write_keys, write_format_tuple))
    time.sleep(0.2)

  SendLEDMessage(MAX_PWM, MAX_PWM, MAX_PWM)



  for intensity in range(0, 255, 50):
    SendLEDMessage(intensity, 0, 0)


  for intensity in range(0, 255, 50):
    SendLEDMessage(0, intensity, 0)

  for intensity in range(0, 255, 50):
    SendLEDMessage(0, 0, intensity)

  SendLEDMessage(0, 0, 0)


def ServoTestSweep(link, write_keys, write_format_tuple, altitude=45):
  """Sweep red laser around 360 degrees."""
  for azimuth in range(0, 360, 10):

    message_dict = GenerateServoMessage(
        laser=LASER_RED, angles=(azimuth, altitude))
    link.Write(DictToValueTuple(message_dict, write_keys, write_format_tuple))

    time.sleep(WRITE_DELAY_TIME)


last_angles = (0, 0)
last_laser = LASER_OFF
last_led = LED_OFF
def GenerateServoMessage(
    angles=None,
    laser=None,
    led=None,




                            <----SKIPPED LINES---->