Are you sure writing your own P loop is necessary in this case? The built-in motor commands should work fine. Assuming that the tray has a one motor lift, then the C++ code would look something like this:
if(con.ButtonDown.pressing())
trayMotor.startRotateTo(0,deg,40,vex::velocityUnits::pct); // 0 is down position
if(con.ButtonUp.pressing())
trayMotor.startRotateTo(100,deg,40,vex::velocityUnits::pct); // 100 is up