When the program ends, it will release the motor. You may want to make sure the program doesn’t end. Add a sleep(??) to the end. Or, a put a while loop at the end.
Has the code above worked in v4.06? These methods did not work and do not step in during debugging. None of the encoder or target methods worked. But I was in the emulator mode. Maybe it has to be plugged in. Thank you.
//If the brake mode of motor 1 is not set to ‘Hold’ mode, //set it to Hold mode if(getBrakeMode(motor1) != motorHold) { setBrakeMode(motor1, motorHold); } Should do it. If you go to robotC program you will see some sample code. It worked for me.