Vex code Memory permission error

I am getting a Memory permission error.

This happens when I press the button (L1) and instead of my piston moving everything freezes and the Memory permission error appears on the brain.
Before I press the button, I am still able to drive around fine and my auton works perfect as well even though it calls the exact same function that moves the piston.
This used to be able to work fine so I am not sure why it is suddenly doing this.

Any help would be appreciated, Thanks!

Code → Python Text in Vex code V5
Error message → Memory permission error 0380DE6C
Actual Code → 6 m official.v5python (12.6 KB)

Edit → i belive it is somthing to do with these lines of code
controller_1.buttonL1.pressed(test)
controller_1.buttonX.pressed(lock)
controller_1.buttonY.pressed(Open)

Is there somthing wong with that or is there somthing wrong with how i write the functions

def Open():
back.stop()
back.set_velocity(100, PERCENT)

def lock():
back.spin(FORWARD, .6, VOLT)

#clamping function
def test():
global myVariable, pnumaticsOn
if pnumaticsOn:
pnumatics.set(False)
pnumaticsOn = False
wait(.1, SECONDS)
else:
pnumatics.set(True)
pnumaticsOn = True
wait(.1, SECONDS)

That’s an issue with the VM related to scheduling, not sure how to solve that one (or if I can)

Add a

wait(10, MSEC)

to the end of the While True: loop in driver control and it should be ok.

3 Likes