Skip to content

Top and bottom scroll at the same time. #12

@brechmos

Description

@brechmos

Hi,

I hope you are still checking the project :-). Thanks for setting it all up.

I am trying to get the top and bottom lines to scroll at the same time. When I run the code below it will scroll the top and then when it is off the screen it will scroll the bottom. When the bottom is done, then back to the top.

How can I make it scroll the two lines at the same time?

Thanks...

The code below is basically what I am trying to do. My code isn't as clean as I would like but I have been trying lots of different things.

import time
import alphasign
import datetime


def main():
  sign = alphasign.Serial(device="/dev/ttyS0")
  sign.connect()
  sign.clear_memory()

  # create logical objects to work with
  top_str = alphasign.String(label="A", size=80)
  top_txt = alphasign.Text("%s%s" % (alphasign.colors.RED, top_str.call()),
                               label="A",
                               mode=alphasign.modes.COMPRESSED_ROTATE,
                               position=alphasign.positions.TOP_LINE)

  bottom_str = alphasign.String(label="B", size=80)
  bottom_txt = alphasign.Text("%s%s" % (alphasign.colors.GREEN, bottom_str.call()),
                               label="B",
                               mode=alphasign.modes.COMPRESSED_ROTATE,
                               position=alphasign.positions.BOTTOM_LINE)

  # allocate memory for these objects on the sign
  sign.allocate((top_str, top_txt, bottom_str, bottom_txt))

  # tell sign to only display the counter text
  #sign.set_run_sequence((top_str, top_txt, bottom_str, bottom_txt,))
  sign.set_run_sequence((top_txt, bottom_txt,))

  # Write the initial data.
  top_str.data = '{}This is a long message that should scroll'.format( alphasign.speeds.SPEED_3)
  bottom_str.data = '{}{}'.format( alphasign.speeds.SPEED_3, datetime.datetime.now().strftime('Today is %m/%d/%Y %H:%M'))
  sign.write(top_str)
  sign.write(top_txt)
  sign.write(bottom_str)
  sign.write(bottom_txt)

  while True:
    bottom_str.data = '{}{}'.format( alphasign.speeds.SPEED_3, datetime.datetime.now().strftime('Today is %m/%d/%Y %H:%M'))
    #sign.write(top_txt)
    sign.write(bottom_str)
    #sign.write(bottom_txt)
    time.sleep(10)


if __name__ == "__main__":
  main()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions