Difference between revisions of "Mindstorms Programming Exercise Prelab"
m (10 revisions) |
|||
(9 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
< | <p><b>Print and hand in this exercise at the beginning of the Sensors Lab. | ||
It will count as the quiz for the Sensors Lab</b></p> | |||
<p>This assignment will introduce you to the fundamentals of Mindstorms | |||
<p>This assignment will introduce you to the fundamentals of | |||
programming. Each student will be assigned a programming task by their TA. You | programming. Each student will be assigned a programming task by their TA. You | ||
will write a program in | will write a program in Mindstorms that uses sensors to complete the task assigned | ||
to you.</p> | to you.</p> | ||
Line 13: | Line 11: | ||
<p>This program will run motors A and B, reversing motor A after 4 seconds. | <p>This program will run motors A and B, reversing motor A after 4 seconds. | ||
Then, it will stop motors A and B when touch sensor 2 is released.</p> | Then, it will stop motors A and B when touch sensor 2 is released.</p> | ||
<h3>Program B</h3> | <h3>Program B</h3> | ||
Line 21: | Line 16: | ||
<p>This program will run motor A while touch sensor 3 is released. When touch | <p>This program will run motor A while touch sensor 3 is released. When touch | ||
sensor 3 is pressed, motor A will reverse for 2 seconds and stop.</p> | sensor 3 is pressed, motor A will reverse for 2 seconds and stop.</p> | ||
<h3>Program C</h3> | <h3>Program C</h3> | ||
Line 30: | Line 22: | ||
light sensor 2 is greater than 35, it will reverse motor A for 6 seconds and | light sensor 2 is greater than 35, it will reverse motor A for 6 seconds and | ||
then stop the motor.</p> | then stop the motor.</p> | ||
<h3>Program D</h3> | <h3>Program D</h3> | ||
Line 38: | Line 27: | ||
<p>This program will run motor A after 3 seconds when touch sensor 3 is released | <p>This program will run motor A after 3 seconds when touch sensor 3 is released | ||
and then reverse motor A for 3 seconds when touch sensor 3 is pressed. This | and then reverse motor A for 3 seconds when touch sensor 3 is pressed. This | ||
program should continually check the | program should continually check the sensor's state by jumping to the beginning.</p> | ||
<h3>Program E</h3> | <h3>Program E</h3> | ||
Line 47: | Line 33: | ||
<p>This program will run motors A and B until touch sensor 3 is touched, and then | <p>This program will run motors A and B until touch sensor 3 is touched, and then | ||
will reverse the motor for 3 seconds and then all motors stop.</p> | will reverse the motor for 3 seconds and then all motors stop.</p> | ||
<h3>Program F</h3> | <h3>Program F</h3> | ||
Line 55: | Line 38: | ||
<p>This program will run motor A after 3 seconds when light sensor 3 is greater | <p>This program will run motor A after 3 seconds when light sensor 3 is greater | ||
than 40 and then reverse motor A for 3 seconds when light sensor 3 is less than 40. | than 40 and then reverse motor A for 3 seconds when light sensor 3 is less than 40. | ||
This program should continually check the | This program should continually check the sensor's state by jumping to the beginning.</p> | ||
<h3>Program G</h3> | <h3>Program G</h3> | ||
Line 64: | Line 44: | ||
<p>This program will run motors A and B and wait for light sensor 3 to be less than | <p>This program will run motors A and B and wait for light sensor 3 to be less than | ||
25. Then, the program will reverse motor B for 3 seconds and then all motors stop.</p> | 25. Then, the program will reverse motor B for 3 seconds and then all motors stop.</p> | ||
<h3>Program H</h3> | <h3>Program H</h3> | ||
<p>This program will wait for 4 seconds and run motor B. | <p>This program will wait for 4 seconds and run motor B. Then, it will reverse | ||
motor B when the distance of ultrasonic sensor 3 is less then 10 cm or run motor | |||
second | A for 1 second when the distance of ultrasonic sensor 3 is greater then 50 cm.</p> | ||
<h3>Program I</h3> | <h3>Program I</h3> | ||
Line 84: | Line 58: | ||
of the program.</p> | of the program.</p> | ||
[[Main_Page | Return to Table of Contents]] | |||
Latest revision as of 03:07, 11 July 2011
Print and hand in this exercise at the beginning of the Sensors Lab. It will count as the quiz for the Sensors Lab
This assignment will introduce you to the fundamentals of Mindstorms programming. Each student will be assigned a programming task by their TA. You will write a program in Mindstorms that uses sensors to complete the task assigned to you.
Program A
This program will run motors A and B, reversing motor A after 4 seconds. Then, it will stop motors A and B when touch sensor 2 is released.
Program B
This program will run motor A while touch sensor 3 is released. When touch sensor 3 is pressed, motor A will reverse for 2 seconds and stop.
Program C
This program will run motor A when light sensor 2 is less than 35. When light sensor 2 is greater than 35, it will reverse motor A for 6 seconds and then stop the motor.
Program D
This program will run motor A after 3 seconds when touch sensor 3 is released and then reverse motor A for 3 seconds when touch sensor 3 is pressed. This program should continually check the sensor's state by jumping to the beginning.
Program E
This program will run motors A and B until touch sensor 3 is touched, and then will reverse the motor for 3 seconds and then all motors stop.
Program F
This program will run motor A after 3 seconds when light sensor 3 is greater than 40 and then reverse motor A for 3 seconds when light sensor 3 is less than 40. This program should continually check the sensor's state by jumping to the beginning.
Program G
This program will run motors A and B and wait for light sensor 3 to be less than 25. Then, the program will reverse motor B for 3 seconds and then all motors stop.
Program H
This program will wait for 4 seconds and run motor B. Then, it will reverse motor B when the distance of ultrasonic sensor 3 is less then 10 cm or run motor A for 1 second when the distance of ultrasonic sensor 3 is greater then 50 cm.
Program I
This program will run motor A for 3 seconds, and then wait for touch sensor 2 to be pushed. Then, it will reverse motor A. Then it will wait for touch sensor 2 to be released, and continually run this set of operations by jumping to the beginning of the program.