Storing Values as Variables

Slides:



Advertisements
Similar presentations
Robofest 2005 Introduction to Programming RIS 2.0 RCX Code.
Advertisements

EducateNXT Follow the Leader Using Bluetooth communication, one robot can be made to follow the actions of a second robot. Features in this presentation:
Dublin Robotics Boosters NXT-Step Programming Workshop.
EducateNXT Enter the name “Sound Graphing” for your experiment. Real-time Data Logging Click the Switch to NXT Data Logging icon in the top-left corner.
NXT Basics: Technic Building and NXT-G Erin Cejka Riecker Center for Engineering Educational Outreach Tufts University.
© 2006 Carnegie Mellon Robotics Academy Designed for use with the LEGO MINDSTORMS ® Education NXT Software and Base Set #9797 Automated Mining Project.
Bluetooth Remote Control
Available at: – Program Optical Quad Encoders in Autonomous Mode Program optical quad encoders in autonomous mode.
EIGHTH GRADE ROBOTICS KITTATINNY REGIONAL HIGH SCHOOL MR. SHEA Introduction to Programming
© 2006 Carnegie Mellon Robotics Academy Designed for use with the LEGO MINDSTORMS ® Education NXT Software and Base Set #9797 Sentry System One-Way Communication.
EducateNXT NXT... an introduction The Kit and the Software.
Reviewing Common Blocks for St. Agnes Elementary School Teachers by Jenny Chang Feb. 26th, 2007 USC & University Neighborhood Outreach Robotics STEM program.
LEGO Mindstorms NXT Programming We will be using the Common Palette for our Robots This is how you download your program onto the brick Drag and drop a.
Program ultrasonic range sensor in autonomous mode
Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.
Getting Started! Lego Mindstorms Program NXT 2.0.
Available at: Lesson 3.6 – Program Line Follower in Autonomous Mode Program Line Follower in Autonomous Mode.
ROBOTICS MY BLOCKS. OBJECTIVES Create, edit and configure a my block Insert a my block inside a program and test its functionality.
ADVANCED EV3 PROGRAMMING LESSON
LabVIEW Basics Review LabVIEW Robotics Fundamentals.
Programming a light sensor to follow a black line.
Robotics Light sensor. Calibration. Reverse engineering challenge. Lab work: Create and show your program. Add light sensor (different orientations). Robot.
Application of Data Programming Blocks. Objectives  Understand the use of data programming blocks and their applications  Understand the basic logic.
NXT Basics: Technic Building and NXT-G Erin Cejka Riecker Center for Engineering Educational Outreach Tufts University.
Available at: Lesson 3.5 – Program Light Sensor in Autonomous Mode Program Light Sensor in Autonomous Mode.
Real-Time Data through Data Hubs. Begin by adding a basic Move block, 5 rotations 75% power.
Introduction to Data & Advanced Programming Blocks ROBOTICS II Module 1 Done by: Eng Nooran Drak.
Negative Power or Negative Rotation makes robot go backwards. But if both are negative, the robot will go forward! Move Steering Block.
Find the Mindstorms Icon on the computer.. To start a new program click go.
Robotics NXT-G: variables, file Rotation sensor Lab: Use buttons to hit specific ball. Homework: Postings. Start planning mapping the room.
Vex Robotics Program four: reversing and turning.
By Droids Robotics INTERMEDIATE PROGRAMMIN G LESSON DATA WIRES.
Programming 101 The Common Palette Content provided by Connor Statham (9 th Grade Student) Formatting by Shannon Sieber.
Data Hubs and Wires. Begin by adding a basic Move block, 5 rotations 75% power.
Mindstorm NXT-G Introduction Towson University Robotics.
Vex Robotics program three: using motors and sensors together.
Casne.ncl.ac.uk Taking care of the CrumbleBot Please do NOT stress the robot's motors 1.Do NOT push the robot 2.Do NOT hold the.
Mechanical Components and Programming Ken Youssefi Introduction to Engineering – E10 1.
Lego Mindstorm Robots 9797 kit.  Students will learn how to identify how to detect a change in a condition.  Students will learn where and how to identify.
© 2006 Carnegie Mellon Robotics Academy Designed for use with the LEGO MINDSTORMS ® Education NXT Software and Base Set #9797 Sentry System Two-Way Communication.
Python Programming Module 4 Sensors and Loops Python Programming, 2/e1.
EV3 Programming By Dianna de Matos.
Introduction to Programming in RobotC
Exploring Computer Science Lesson 6-5
3D Animation: Fashion Show
Introduction To Programming with LEGO NXT 2
Sensors Training.
By Sanjay and Arvind Seshan
Automation and Robotics
Programming.
Module F: Presentation Understanding Robot Fundamentals
Displaying sensor values while a robot is running
Sensors and Logic Switches
INTERMEDIATE PROGRAMMING LESSON
Loops with Multiple Sensor Controls
Exploring Computer Science Lesson 6-5
Forward Until Touch Robot goes forward until it hits a wall.
Controlling your quadcopter
INTERMEDIATE PROGRAMMING LESSON
Holyoke Codes LEGO ROBOTICS
Switch Blocks check a value and choose a path based on that value
By Sanjay and Arvind Seshan
Repeating Behaviors.
Lesson 4 Variables.
Module 5 ● Vocabulary 1 a sensing block which will ask whatever question is typed into the block and display an input text box at the bottom.
Lego MINDSTORMS EV3.
Getting started with LEGO EV3 Mindstorms software
Implementing Variables in Your Programs
Controlling your quadcopter
LEGO MINDSTORMS NXT PROGRAMMING
Presentation transcript:

Storing Values as Variables Variable = a place to store a value

Sensor values can be stored as variable. Values stored as number variables can be mathematically modified. Text values can have additional text added. The most common use is to compare variables against other values to see if the value meets a certain threshold. Common uses for Variables: Storing Sensor Values Counting

Storing and Displaying Sensor Values Program a robot to go into a tunnel and take a light sensor reading after 1 rotation; come back out of the tunnel and displays the value.

Start with a program that will drive the robot into the tunnel and then back out of the tunnel. 1 Place two Move Blocks on the sequence beam. One going into the tunnel and another backing out of the tunnel. 1

Programming the sensor readings inside the tunnel Place a light sensor block inside the code following the forward movement. Uncheck Generate light so that the sensor does not detect its own reflected light inside the tunnel.

Detecting the Light Sensor’s own Reflected Light If the “Generate Light” checkbox is checked, the light sensor will turn on its own small light source and detect the color that is reflected back to it. With the Generate light function on, the light sensor can detect the amount of light that is reflected back from a variety of shades of colors. With the Generate light function off the light sensor can detect the amount of ambient light that is surrounding the light sensor.

Adding a Variable Block From the Data Palette place a Variable Block after the Light Sensor Block.

Assigning Variable types Light Sensors values are numbers. Configure the Variable Block to use the Number Variable called Number 1. The value must be stored so the Light Sensor must write the value under actions.

Wire the Intensity Output Plug on the Light Sensor Block to the Input Plug on the Variable Block. The Variable Block now holds the value that will need to be displayed after the robot exits the tunnel.

Displaying Stored Data

After the Variable Read Block, add a Number to Text Block followed by a Display Block. Wire the Blocks as shown. Configure the Display Block to display the converted Text.

Add a Wait Block at the end of the program to allow time to read the displayed value. Set the wait time to 10 Seconds. 10

Download and run the program Download and run the program. Check the NXT screen for the Light Sensor Display Value. 33

Part Two: Storing and Displaying More Than One Sensor Values Program the robot to go into a tunnel, take a light sensor reading after 1 rotations and then again after 3 more rotations; come back out of the tunnel and display both values.

Add a 2 rotation Movement Block after the first variable

Add another Sensor Block to read the new sensor value and a Variable Block to store the second value. 2

There is only one Number Variable called Number 1, that variable is holding the first sensor value. Create a new Number Variable. Go to Edit and Define Variables. Create a variable named Number 2. Make the Datatype a Number

Configure Variable Block 2 to write to the variable named Number 2 Configure Variable Block 2 to write to the variable named Number 2. Wire the output Plug on the Light Sensor Block to the input plug on the Variable Block.

Create a second variable display just like the first one Create a second variable display just like the first one. Place the Variable Block before the Wait Block. Format the Variable Block to Read the Variable named Number 2.

Format the Display Block to Text. Create a second Number to Text just like the first one. Place the Number to Text after the Number 2 Variable Block. Place a Display Block after the Number to Text Block. Wire the blocks together. Format the Display Block to Text.

Display Block Settings The two Display Blocks are set to display the values in exactly the same place on the NXT screen. Change the First Display Block Display setting by dragging the Mindstorms NXT text to the top of the text box. Change the second Display Block by removing the check from Clear so that both numbers are displayed for 5 seconds.

Currently the robot goes forward 1 rotation then forward 2 more rotations equaling 3 rotations. Change the Reverse Motor Block from 1 rotation to 3 rotations so that the robot completely exits the tunnel before displaying the Sensor Values. 3

Download and Run the Program. The robot should display two light sensor values on the NXT screen.