click below
click below
Normal Size Small Size show me how
Stack #4613684
| Question | Answer |
|---|---|
| What is the difference between using // and /* */ in your program? | // is for single line pseudocode. /* turns on multiline pseudocode and */ turns it off. |
| How does a while() loop work? | With a while loop the robot checks the condition. As long as the condition is still true, the commands inside the curly brackets will be run. As soon as the condition is not longer true, the robot stops running the response. |
| With 4 inch diameter wheels, about how far will a robot move if the wheels rotate 720 degrees? | C=pi*d. C= 3.14*4” = 12.57” So 720/360 (degrees per rotations) = 2 rotations. 2 rotations * 12.57” per rotation = 25.14inches. (A little more than 2 feet. |
| Why do you need ==-1 as part of the conditions when using sonarSensors? | You need the || ==-1 with the sonar sensors because if a target is out of sensor range then the sonar sensor will detect nothing. So if SensorValue[sonarSensor] >range || |
| Why must the “reset encoders” command be written outside, instead of inside, the while loop? | If “reset encoders” command were inside the while loop, the encoders would constantly reset and the robot would never reach its goal. |
| Which of the following is the proper lift arm code? | To lift the arm, you would use motor[armMotor]=(some #); //to turn the motor on. Wait1Msec(some value); to allow the arm motor to run for a certain amount of time. Then motor[armMotor]=0;//to turn the motor off |
| How does battery level affect motor speed? | Weaker batteries make the motors run with less power. So if you are simply relying on motor power and timing to get distance, then the robot will not move accurately. Therefore, we use the encoders. |
| With " while (1==1) " how many times will this while loop run? | While(1==1) is always true. So that condition will always run. In this code, a constant value is set for the distance previously traveled. It remembers how far it went. |
| const float traveled = SensorValue[leftEncoder]; (What is happening in this code?) | In this code, a constant value is set for the distance previously traveled. It remembers how far it went. |
| How much time will the program wait before moving? wait1Msec(4200); | Wait1Msec(4200); is equal to 4.2 seconds |
| Which ROBOTC command allows you to set the power level for a motor connected to your robot? | Motor[“motorName”] = some number; //sets the motor power level. |
| What is the purpose of using functions? How does it make writing code easier? | Functions are a series of commands that you will use multiple times in a program. Creating functions allows the code to be shorter. |
| In ROBOTC programming, all simple statements end with a(n): | Commands end with a semicolon. |
| If you have 4" wheels and want the robot's wheels to rotate 1520', how many feet is this equivalent to | Similar to 3. C=pi*d. C= 3.14*4” = 12.57”. 1520/360 = 4.2 rotations. 2 rotations * 12.57”/rotation = 52.79”. 52.79” /12”per foot = 4.4 feet. |
| What is the range of the power level options for the VEX motors? | . Vex motors can run from 0-127 (+ for forward, - for backward.) |
| What is the purpose of " SensorValue[leftEncoder] = 0; " | That command resets the encoders. |
| What are the 3 parts of a function? | . Declaration, 2. Definition. 3. Usage |
| What pseudocode would best fit this code: while((SensorValue[sonarSensor] > 10 ) || (SensorValue[sonarSensor] !=-1)) | While the object is more than 10 cm away, OR no object is detected. |
| If "count" starts at zero and while(count <=5), how many times would the while loop run? | 6 times. (It will run on 0,1,2,3,4,5) |
| What is a float variable used for? | Float variables are used when the value will be a short decimal |
| How do you make your robot swing turn? | A swing turn is when one wheel is on, and the other is off |
| How do you make your robot point turn? | A point turn has one wheel running forward and the other wheel running at the same speed in reverse. (example: point turn right. Left motor forward 60, right motor backward 60. |
| What does the sonar sensor do? (How do you write code for it?) | The sonar sensors detect the distance to an object. |
| What will the robot do if the threshold is 1570 and you are shown 3 if statements with specific values? | If a variable is titled threshold, then the only if statement that will run is the one whose condition is above the threshold value of that sensor. |