up key sets lock variable to 0, or off down key sets lock variable to 1, or on please use this code in your stuffs that needs it
This was actually my second project.