Esempio n. 1
0
	colorSequence = Sequences.GenerateHueGradient(limit=TRIALS)

	if DUMMY_SERIAL:
		sender = DataSender.DummySender(SERIAL_DEVICE,
			silent=True)
	else:
		sender = DataSender.Sender(SERIAL_DEVICE)
	# Open the serial connection.
	with sender:

		# SendingBuffer has a list of Color objects and encapsulates
		# requisite logic for generating bytes and sending.
		# For simulating, TurtleBuffer subclasses SendingBuffer and
		# draws to the screen using Turtle Graphics as well.
		if DRAW:
			sendingColorBuffer = TurtleBuffer(sender=sender)
		else:
			sendingColorBuffer = SendingBuffer(sender=sender)

		# Put some known colors at the beginning.
		for c in Sequences.GetSentinels():
			sendingColorBuffer.insertAndPop(c)

		for c in colorSequence:
			t = time.time()

			# Insert the next color into one end of the strip (and
			# pop the oldest color from the other end).
			sendingColorBuffer.insertAndPop(c)
			"""
			insertAndPop, see Buffer.py
Esempio n. 2
0
from Manifest import ledcontroller, sys

from ledcontroller.Manifest import time, data_sender
from ledcontroller.Manifest import SendingPatternList, Color, \
  TurtleBuffer, sequences
from ledcontroller.patterns.Manifest import InterpolatedMarquee, Pulser

if __name__ == '__main__':
  # A SendingPatternList holds the list of Patterns (which create the
  # colors), and manages writing them to the Arduino.
  if not DRAW:
    # Create a SendingBuffer with defaults.
    color_sender = SendingPatternList()
  else:
    color_sender = SendingPatternList(sending_buffer=TurtleBuffer())

  # Add some Patterns.
  #color_sender.Append(InterpolatedMarquee(
  #  sequences.GenerateRandom(bright_interval=6),
  #    speed=15))
  color_sender.Append(InterpolatedMarquee(
    (c.Scaled(0.1) for c in
     sequences.GenerateHueGradient(repeat_interval=50)),
    speed=5.0))
  color_sender.Append(Pulser(
      color=Color(rgb=(0, 0, 1)),
      reverse=True,
      add_delay=3.0))

  # Open the serial device (connection to the Arduino).
Esempio n. 3
0
    #  brightInterval=5)
    color_sequence = sequences.GenerateHueGradient(limit=TRIALS)

    if DUMMY_SERIAL:
        sender = data_sender.DummySender(SERIAL_DEVICE, silent=True)
    else:
        sender = data_sender.Sender(SERIAL_DEVICE)
    # Open the serial connection.
    with sender:

        # SendingBuffer has a list of Color objects and encapsulates
        # requisite logic for generating bytes and sending.
        # For simulating, TurtleBuffer subclasses SendingBuffer and
        # draws to the screen using Turtle Graphics as well.
        if DRAW:
            sending_color_buffer = TurtleBuffer(sender=sender)
        else:
            sending_color_buffer = SendingBuffer(sender=sender)

        # Put some known colors at the beginning.
        for c in sequences.GetSentinels():
            sending_color_buffer.InsertAndPop(c)

        for c in color_sequence:
            t = time.time()

            # Insert the next color into one end of the strip (and
            # pop the oldest color from the other end).
            sending_color_buffer.InsertAndPop(c)

            # Send the updated colors to the Arduino.
	colorSequence = Sequences.GenerateHueGradient(limit=TRIALS)

	if DUMMY_SERIAL:
		sender = DataSender.DummySender(SERIAL_DEVICE,
			silent=True)
	else:
		sender = DataSender.Sender(SERIAL_DEVICE)
	# Open the serial connection.
	with sender:

		# SendingBuffer has a list of Color objects and encapsulates
		# requisite logic for generating bytes and sending.
		# For simulating, TurtleBuffer subclasses SendingBuffer and
		# draws to the screen using Turtle Graphics as well.
		if DRAW:
			sendingColorBuffer = TurtleBuffer(sender=sender)
		else:
			sendingColorBuffer = SendingBuffer(sender=sender)
			sendingColorBuffer1 = SendingBuffer(sender=sender)
			sendingColorBuffer2 = SendingBuffer(sender=sender)
			sendingColorBuffer3 = SendingBuffer(sender=sender)
			sendingColorBuffer4 = SendingBuffer(sender=sender)
			# sendingColorBufferCenter = SendingBufferCenter(sender=sender)

		# Put some known colors at the beginning.
		for c in Sequences.GetSentinels():
			sendingColorBuffer.insertAndPop(c)
			sendingColorBuffer1.insertAndPop(c)

		for c in colorSequence:
			t = time.time()
Esempio n. 5
0
	colorSequence = Sequences.GenerateHueGradient(limit=TRIALS)

	if DUMMY_SERIAL:
		sender = DataSender.DummySender(SERIAL_DEVICE,
			silent=True)
	else:
		sender = DataSender.Sender(SERIAL_DEVICE)
	# Open the serial connection.
	with sender:

		# SendingBuffer has a list of Color objects and encapsulates
		# requisite logic for generating bytes and sending.
		# For simulating, TurtleBuffer subclasses SendingBuffer and
		# draws to the screen using Turtle Graphics as well.
		if DRAW:
			sendingColorBuffer = TurtleBuffer(sender=sender)
		else:
			sendingColorBuffer = SendingBuffer(sender=sender)

		# Put some known colors at the beginning.
		for c in Sequences.GetSentinels():
			sendingColorBuffer.insertAndPop(c)

		for c in colorSequence:
			t = time.time()

			# Insert the next color into one end of the strip (and
			# pop the oldest color from the other end).
			sendingColorBuffer.insertAndPop(c)

			# Send the updated colors to the Arduino.