How do I add pause(2) after the loop ends and before calling StopCreate?
이전 댓글 표시
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
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Code Generation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!