reviewing common blocks
Download
Skip this Video
Download Presentation
Reviewing Common Blocks

Loading in 2 Seconds...

play fullscreen
1 / 46

Reviewing Common Blocks - PowerPoint PPT Presentation


  • 102 Views
  • Uploaded on

for St. Agnes Elementary School Teachers by Jenny Chang Feb. 26th, 2007 USC & University Neighborhood Outreach Robotics STEM program Reference: LEGO MINDSTORMS NXT Help & Support Pages. Reviewing Common Blocks. Move Block.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Reviewing Common Blocks' - miles


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
reviewing common blocks
for St. Agnes Elementary School Teachers

by

Jenny Chang

Feb. 26th, 2007

USC & University Neighborhood Outreach Robotics STEM program

Reference:

LEGO MINDSTORMS NXT Help & Support Pages

Reviewing Common Blocks
move block
Move Block
  • The letters at the top right corner of the block show which of your NXT’s ports will be controlled.
  • This icon shows which direction your robot will go.
  • This icon shows the power level. Your robot’s speed may also be affected by other conditions, like the surface it is moving over or whether it is moving up or down a slope.
  • This icon shows whether you have set the Duration property to unlimited, degrees, rotations, or seconds
move block cont
Move Block (cont.)
  • This icon shows that the Direction property is set to “stop”. This setting will stop all motors.
configuring the move block
Configuring the Move Block
  • Select the motors you would like to control. Motors will be synchronized, going forward or backwards at exactly the same power.
  • Choose whether the motors will go forward, go backwards, or stop. Selecting Stop will also reset the motors.
  • Move the slider to set a curved path for your robot. With the slider all the way to either side, your vehicle will spin in place.
  • This slider and the editable input box will let you set the power level [0-100%].
configuring the move block cont
Configuring the Move Block (cont.)
  • By choosing Time, Rotation or Degrees you can control how far your robot will travel.
  • Choose whether the motors will brake or coast after they’ve finished their action. If you want your robot to stop precisely at an exact location, set the motors to brake. This may wear out battery on a slope because the motors are doing work to keep the robot in place.
  • The feedback boxes will count how many degrees or full rotations your motors turn. Press the reset button to return the values to zero.
motor versus robot direction
Motor versus Robot Direction
  • When you set a Move or Motor blocks' direction, you are specifying the direction the motor will spin. This may be different than the direction your robot actually moves. The image below shows a motor spinning in the default, forwards direction.
record play block
Record/Play Block
  • This block lets you record an action that you act out with your robot. It does this by remembering how many times the motors turn on your robot and then replaying the correct number of turns when you select “run” on your Record/Play block and run your program.
  • 1. The displayed icon shows whether the block is set to record or play.
configuring the record play block
Configuring the Record/Play block
  • Use the text field to name the motion that you are going to act out.
  • Check the output ports that you would like to record. If you have motors connected to ports B and C, check the B and C checkboxes.
  • Set the length of time you would like to record in seconds.
configuring the record play block cont
Configuring the Record/Play block (cont.)
  • If you choose to play an already recorded Record/Play file, the configuration panel will look like the one above.
  • 1. Type in the file name of the recorded action you want to replay. Files that have already been saved on the NXT will appear in the list in alphabetical order. Select the one you would like to play.
  • Note: If you record and play an action in the same program, you must remember to type in the same file name in both blocks – the file name will not appear in the list of previously saved actions.
sound block
Sound Block
  • You can use this block to play a sound file or a single tone. To compose a melody of tones, arrange several sound blocks in a row with each set to play different tones.
  • If you select “Wait for completion” in the configuration panel, the sound file or tone will finish playing before the program moves on to the next block. With this item unchecked, the sound file or tone will continue to play while the next block of your program proceeds.
  • Choosing “Repeat” will cause a sound file to play again and again.
sound block cont
Sound Block (cont.)
  • This icon shows whether the block will play a sound file or a tone.
  • This icon shows whether the block will start or stop playing a sound.
  • This icon shows the block’s volume. An icon with four orange bars is set to the loudest volume.
  • You can drag data wires from other blocks to this block’s data hub that will affect the Sound block’s properties.
configuring the sound block
Configuring the Sound Block
  • 1. The Action property radio buttons let you choose to play a sound file or a tone that you’ll compose.
  • 2. Choose to play or stop playing a sound file or tone.
  • 3. Set the volume using the slider. Use the text field to type in an exact value.
slide13
If you choose to play a sound file (as in the first configuration panel above), you’ll be able to set the following additional properties:
  • 4. The Function property will let you set the sound file to repeat so that it plays again and again without stopping. The “Wait for completion” option will be grayed out and no longer available.
  • 5. The File property will let you choose the sound file by its name. Look in Sound Files folder of the LEGO MINDSTORMS software on your hard drive for sounds. Click on each name to hear it played.
  • 6. If you check the “Wait for Completion” checkbox, the sound file will play to its end before allowing the program to move on the next block.
slide14
If you choose to play a tone (as in the second configuration panel above), you’ll be able to set the following additional properties:
  • 4. The Node property will allow you to compose a tone to play when the Sound block is activated. The small keyboard represents three octaves of the musical scale. The input box next to the stopwatch is for specifying the duration of the note in 1/10s of a second.
  • 5. If you check the “Wait for Completion” checkbox, your tone will play to its end before allowing your program to move on the next block in your program. With the box unchecked, your tone will play while the next block of your program proceeds.
display block
Display Block
  • By positioning several Display blocks in a row you can create more complex drawings by adding additional images, text and shapes with each new Display block.
  • If you want to erase the contents of the screen before beginning, check the “Clear” checkbox.
  • If you would like to return to the default LEGO MINDSTORMS icon, select Reset in the pull-down menu.
  • The screen measures 100 pixels wide by 64 pixels high.
display block cont
Display Block (cont.)
  • 1. This icon shows whether the block is set to display an image, some text, or a drawing; or whether it will just reset the display to the default icon.
  • 2. You can change values dynamically by connecting data wires to this block’s data hub.
slide17
1. Use the pull-down menu to choose whether you want to display an image, some text, or your own drawing; or whether you just want to reset the display.
  • 2. To erase the contents of the NXT’s screen, check the “Clear” checkbox.
  • If you choose to display an image (as in the configuration panel above), you’ll be able to set the following additional properties:
  • 3. The File property will you let select the image to display. Click on each name to see a preview. Images are stored in the Image Files folder of the LEGO MINDSTORMS software on your hard drive.
  • 4. Use your mouse to move an image, some text, or a drawing around the preview screen to position it. The X and Y input boxes let you precisely position the image. Typing zeros into both boxes will set the image against the left and bottom edges of the screen.
loop block
Loop Block
  • 1. When a Loop block’s action property is set to “Forever,” an infinity symbol (∞) is displayed at the bottom of the trailing portion of the block.
  • 2. If the “Show Counter” checkbox is selected in the configuration panel, a plug will appear that will allow you to use the number of completed loops as an input elsewhere in your program. You can also use current count to control the loop itself.
  • 3. If you choose for a sensor to control the loop, the trailing portion of the Loop block will expand in size revealing an icon for the chosen sensor.
loop forever configuration
Loop Forever Configuration
  • If you choose “Forever,” any programming blocks within the loop will repeat forever without interruption.
  • 1. Check the “Show Counter” checkbox to use the number of loops completed as input to another block. (Example: to increase a Motor block’s Power.)
loop with time configuration
Loop with Time Configuration
  • If you choose “Time,” the programming blocks within the loop will repeat until a certain number of seconds have passed. After the time period is up, the loop will end.
  • 1. Use this box to type in the number of seconds that the loop should run. If you choose 5 seconds, for example, the loop will end after 5 seconds have passed.
  • 2. If the “Show Counter” checkbox is selected in the configuration panel, a plug will appear that will allow you to use the number of completed loops as an input elsewhere in your program.
loop with touch sensor
Loop with Touch Sensor
  • If you choose “Touch Sensor,” the programming blocks within the loop will repeat until a touch sensor is bumped, pressed, or released. Then the loop will end and the program will go on.
  • 1. Choose the port that the touch sensor is connected to.
  • 2. Use the radio buttons to specify whether you want the touch sensor to be bumped, pressed, or released to end the loop. Choose Bumped if you want the block to be triggered after a quick press and release of the touch sensor (less than 0.5 seconds in duration). Choose Pressed if you want the block to be triggered at the instant the touch sensor is pressed in. Choose Released if you want the block to be triggered at the instant the touch sensor is released.
loop with touch sensor cont
Loop with Touch Sensor (cont.)
  • 3. The feedback box will let you test your touch sensor. When the sensor is activated on your robot, the number “1” will be displayed here. Use the reset button to clear the feedback box.
  • 4. If the “Show Counter” checkbox is selected in the configuration panel, a plug will appear that will allow you to use the number of completed loops as an input elsewhere in your program.
loop with sound sensor
Loop with Sound Sensor
  • If you choose “Sound Sensor,” the programming blocks within the loop will repeat until the sound sensor detects sound in a certain range.
  • 1. Choose the port where your sound sensor is plugged in. By default, the block will be set to port 2 for a sound sensor.
loop with sound sensor cont
Loop with Sound Sensor (cont.)
  • 2. Use the slider to set the trigger value or type a value directly into the input box. Select the radio button to the right of the slider if you want the loop to end when sound levels are higher than the trigger value; select the left radio button to end the loop when sound levels are lower than the trigger value. You can also use the pull-down menu to set the portion of the slider that will end the loop.
  • 3. The feedback box displays the current sound reading (0-100%). You can use it to try out different trigger values.
  • 4. If the “Show Counter” checkbox is selected in the configuration panel, a plug will appear that will allow you to use the number of completed loops as an input elsewhere in your program.
switch block
Switch Block
  • 1. This icon indicates the sensor or other condition that will cause the block to choose between the two rows of programming blocks. In this case the current status of a touch sensor will cause the program to switch.
  • 2. The upper blocks will run if the touch sensor is pressed.
  • 3. The lower block will run if the touch sensor is not being pressed.
switch block cont
Switch Block (cont.)
  • 1. If you’ve chosen to control the Switch block using the Value condition, a data wire plug will appear at the bottom of the leading edge of the Switch block; you will have to attach a logic or number data wire to this plug from some other block to control the switch.
switch block cont27
Switch Block (cont.)
  • 1. By de-selecting the “Display Flat View” checkbox, the Switch block will use a tabbed interface to show the alternative sequences of programming blocks. By clicking on a tab, you will be able to view and edit the blocks and see which condition will cause those particular blocks to run.
  • Note: When you want to attach a data wire from outside to a block inside the Switch block, you need to de-select the “Display Flat View” so the Switch block appears with its tabbed interface.
wait block
Wait Block
  • This block lets your robot sense its environment for a certain condition before it continues. Use the slider or type in a value to set a trigger point so that the program continues when sensor values are below or above it.
wait block cont
Wait Block (cont.)
  • 1. The number or letter at the top right corner of the Wait block shows the port the block is monitoring. The configuration panel, which is described below, will let you change ports if necessary.
  • 2. If you have chosen to wait for a light, sound, or ultrasonic sensor, this icon indicates at what level the trigger point is set; the more colored bars displayed, the higher the trigger point. If you have chosen to wait for a touch sensor, the icon will display the touch sensor condition (bumped, pressed, or released) that will trigger the block and allow the program to move on.
loop with light sensor
Loop with Light Sensor
  • If you choose “Light Sensor,” the programming blocks within the loop will repeat until a light sensor measures a certain intensity of light. Then the loop will end and the program will advance.
  • 1. Choose the port where your light sensor is plugged in. By default, the block will be set to port 3 for a light sensor.
  • 2. Use the slider to set the trigger value or type a value directly into the input box. Select the radio button to the right of the slider if you want the loop to end when light levels are higher than the trigger value; select the left radio button to end the loop when light levels are lower than the trigger value. You can also use the pull-down menu to set the portion of the slider that will end the loop.
loop with light sensor cont
Loop with Light Sensor (cont.)
  • 3. If you check the “Generated Light” checkbox, the light sensor will turn on its own small light source and detect this light if it is reflected back to it.
  • 4. The feedback box will display the current light reading.
  • 5. If the “Show Counter” checkbox is selected in the configuration panel, a plug will appear that will allow you to use the number of completed loops as an input elsewhere in your program.
loop with ultrasonic sensor
Loop with Ultrasonic Sensor
  • If you choose “Ultrasonic Sensor,” the programming blocks within the loop will repeat until the ultrasonic sensor detects an object at a certain distance.
  • 1. Choose the port where your ultrasonic sensor is plugged in. By default, the block will be set to port 4 for an ultrasonic sensor.
  • 2. Use the slider to set the trigger value or type a value directly into the input box. Select the radio button to the left of the slider if you want the loop to end when the ultrasonic sensor detects an object closer than the trigger value; select the right radio button to end the loop when the ultrasonic sensor detects an object farther away than the trigger value. You can also use the pull-down menu to set the portion of the slider that will end the loop.
loop with ultrasonic sensor cont
Loop with Ultrasonic Sensor (cont.)
  • 3. Select to read values in Centimeters or Inches.
  • 4. The feedback box will display the current ultrasonic sensor reading.
  • 5. If the “Show Counter” checkbox is selected in the configuration panel, a plug will appear that will allow you to use the number of completed loops as an input elsewhere in your program.
loop with nxt buttons
Loop with NXT Buttons
  • If you choose “NXT Buttons,” the programming blocks within the loop will repeat until the chosen NXT buttons is bumped, pressed, or released.
  • 1. Select which NXT button will send out a “true” signal when activated (and end the loop).
  • 2. Choose Bumped if you want the chosen button to be activated after a quick press and release. Choose Pressed if you want the chosen button to be activated at the instant the button is pressed in. Choose Released if you want the chosen button to be activated at the instant the button is released.
loop with nxt buttons cont
Loop with NXT Buttons (cont.)
  • 3. The feedback box will display a “1” when the chosen NXT button is bumped, pressed or released (according to the configuration you’ve set).
  • 4. If the “Show Counter” checkbox is selected in the configuration panel, a plug will appear that will allow you to use the number of completed loops as an input elsewhere in your program.
loop with built in rotation sensor
Loop with (Built-in) Rotation Sensor
  • If you choose to “read” a rotation sensor, the programming blocks within the loop will repeat until the rotation sensor reaches a certain value; then the loop will end and the program will advance. If you choose to “reset” the rotation sensor, the sensor will be reset to zero after each loop; the block will continue to loop until the rotation sensor can reach the trigger value during one of the loops.
  • 1. Choose the port where your motor is plugged in.
  • 2. Choose to read or reset a rotation sensor.
  • 3. Use the radio buttons to set the direction you want: forwards or backwards.
loop with built in rotation sensor cont
Loop with (Built-in) Rotation Sensor (cont.)
  • 4. Choose to count either Rotations or Degrees by using the pull-down menu.
  • 5. Type the number of rotations or degrees you want to go by before the loop is ended (allowing your program to go forward).
  • 6. The feedback box will display the current number of rotations or degrees. Use the reset button to clear the feedback box.
  • 7. If the “Show Counter” checkbox is selected in the configuration panel, a plug will appear that will allow you to use the number of completed loops as an input elsewhere in your program.
loop with timer
Loop with Timer
  • If you choose to “read” a timer, the programming blocks within the loop will repeat until one of the NXT’s internal timers reaches a certain time value; then the loop will end and the program will advance. If you choose to “reset” a timer, the timer will be reset after each loop; the block will continue to loop until the timer can reach its trigger value during one of the loops.
loop with timer cont
Loop with Timer (cont.)
  • 1. Choose the NXT timer that you would like to monitor.
  • 2. Choose to read or reset a timer.
  • 3. Type a time value (in seconds) in the input box.
  • 4. If the “Show Counter” checkbox is selected in the configuration panel, a plug will appear that will allow you to use the number of completed loops as an input elsewhere in your program.
loop with temperature sensor
Loop with Temperature Sensor
  • If you choose “Temperature* Sensor,” the programming blocks within the loop will repeat until a temperature* sensor measures a certain temperature. Then the loop will end and the program will advance.
  • 1. Choose the port where the temperature sensor is plugged in. By default, the block will be set to port 4 for a temperature sensor.
loop with temperature sensor cont
Loop with Temperature Sensor (cont.)
  • 2. Use the slider to set the trigger value or type a value directly into the input box. Select the radio button to the right of the slider if you want the block to be triggered by temperatures higher than the trigger value; select the left radio button to trigger the block with temperatures lower than the trigger value. You can also use the pull-down menu to set the “true” portion of the slider.
  • 3. Select to read values in Celsius or Fahrenheit.
  • 4. The feedback box displays the current temperature reading.
  • 5. If the “Show Counter” checkbox is selected in the configuration panel, a plug will appear that will allow you to use the number of completed loops as an input elsewhere in your program.
loop with count
Loop with Count
  • If you choose “Count,” any programming blocks within the loop will repeat until the Counter reaches a set number of repetitions.
  • 1. Use this box to type in the number of repetitions that will end the loop. If you type “2,” for example, the loop will end after the programming blocks in the loop have been run twice.
  • 2. Check the “Show Counter” checkbox so that you can wire the left side of the loop to the right side (where the “count” plug appeared). With the left and right sides connected, the program will be able to count the number of completed loops and leave the loop when the count reaches the number you set.
loop with logic
Loop with Logic
  • If you choose “Logic” and connect an input data wire to the Loop block’s trailing portion, any programming blocks within the loop will repeat as long as the Loop block is receiving a true or false logic signal through the data wire. When a specified logic signal is received, the loop will end.
  • 1. Choose which type of logic signal, true or false, will end the loop.
  • 2. If the “Show Counter” checkbox is selected in the configuration panel, a plug will appear that will allow you to use the number of completed loops as an input elsewhere in your program.
loop with receive message
Loop with Receive Message
  • If you choose “Receive Message,” the programming blocks within the loop will repeat until your NXT receives a certain Bluetooth message. Then the loop will end and the program will advance.
loop with receive message cont
Loop with Receive Message (cont.)
  • 1. The pull-down menu will let you select the message type (Text, Number, or Logic) of the message that you expect to receive.
  • 2. To compare the incoming message to a test message, either type in the test text or number (if you have chosen Text or Number respectively as the format), or use the radio buttons to choose the test logic value (true or false).
  • 3. Choose the mailbox number where the incoming message will arrive.
  • 4. If the “Show Counter” checkbox is selected in the configuration panel, a plug will appear that will allow you to use the number of completed loops as an input elsewhere in your program.
ad