Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Top and bottom scroll at the same time. #12

Open
brechmos opened this issue Apr 11, 2017 · 0 comments
Open

Top and bottom scroll at the same time. #12

brechmos opened this issue Apr 11, 2017 · 0 comments

Comments

@brechmos
Copy link

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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant