How do I add pause(2) after the loop ends and before calling StopCreate?
Show older comments
How do I add pause(2) after the loop ends and before calling StopCreate?
I tried to insert the pause. Is this script now correct? Using the script below:
function driveForwardUntilWall(serPort) % Robot drives forward until it bumps a wall. % serPort is the serial port number (for controlling the actual robot).
[BumpRight,BumpLeft,~,~,~,BumpFront] = ... BumpsWheelDropsSensorsRoomba(serPort); while ~BumpRight && ~BumpLeft && ~BumpFront SetDriveWheelsCreate(serPort, .5,.5) pause(.1) [BumpRight,BumpLeft,~,~,~,BumpFront] = ... BumpsWheelDropsSensorsRoomba(serPort); end
pause(2.0) %in seconds
StopCreate(serPort) Signal()
%%%%%%%%%%%%%%%%%%%%%%%% function StopCreate(serPort) % Stop the robot % serPort is the serial port number (for controlling the actual robot). SetDriveWheelsCreate(serPort, 0,0)
%%%%%%%%%%%%%%%%%%%%%%%% function Signal() % Make signal sound (4 beeps) n= 4; for k=1:4 beep pause(.2) end
Answers (0)
Categories
Find more on Code Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!