Announcement

Collapse
No announcement yet.

Backgroung leddigit display

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Backgroung leddigit display

    Hello,

    I'm strugling with a programming issue ( Gen4-23DT alone with Visie Genie)



    I use an encoder with the functionQencoder1 : it works great, background counting without any issue.

    I want to display on a leddiggit, a calculated position with the encoder counter and I would like to have this display to run alone in the background and I can't get it to work.


    What I did : I used a button (in Magictouch) to activate a code which calculate and display the position (with a loop) but if I want to access other screens (for setup for example), I need to touch the screen once to exit the loop and again to activate another button. Of course, as soon as I exit the loop, the display is no more updated and I need to remember to touch the button to activate again the position display.
    I tried to paste my code in the Mainloop Magic code but then, I can't get the buttons to works …
    I’m probably missing a nice and smooth solution ….
    Thanks for your help !
    Lorenz’

  • #2
    Hi Lorenz,

    I believe the best solution here would be to have your calculate code function to be always running in the main loop code, but keep the position/result stored in a global variable. Then, store a boolean variable (0 or 1) that controls whether the position is displayed or not. Then when the button is pressed, the boolean is set to true, which then shows the position on screen, and if the form is switched, you can set it the boolean to false and hide the position. Meanwhile, the position is always being calculated the background.

    Alternatively, you could set the form switch events to show and hide the position, so if you are on the main form it will show the position, and if you are on another form like the setup one, it will hide the position.

    Let me know if this is a suitable solution,
    Adem

    Comment

    Working...
    X