Sunscreen motor control

I too am still learning NR basics, and dusting off my limited JavaScript experience, but what I meant was something like global flags.. in pseudocode:

Press UP - if DOWN Flag already active do nothing, else set UP Flag active and process UP, once finished set UP Flag to inactive.