Application of Data Programming Blocks. Objectives  Understand the use of data programming blocks and their applications  Understand the basic logic.

Slides:



Advertisements
Similar presentations
Intermediate Robotics Getting to the Next Level Guiding Question: How might I move the robot consistently, accurately, and predictably? –Review basics.
Advertisements

Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 2 Virtual Instruments Read Bishop, Chapter 2. Lab #2 and Homework #2 due next week. Quiz #1 next week.
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.
Lesson 3 Working with Formulas.
Introduction to arrays
RAPTOR Syntax and Semantics By Lt Col Schorsch
Microsoft Office XP Microsoft Excel
 Variables  What are they?  Declaring and initializing variables  Common uses for variables  Variables you get “for free” in Processing ▪ Aka: Built-in.
Concepts of Database Management Seventh Edition
Concepts of Database Management Sixth Edition
Concepts of Database Management Seventh Edition
Mrs. Chapman. Tabs (Block Categories) Commands Available to use Script Area where you type your code Sprite Stage All sprites in this project.
Copyright 2003, Paradigm Publishing Inc. CHAPTER 3 BACKNEXTEND 3-1 LINKS TO OBJECTIVES AutoSum Button Mathematical Operators Mathematical Operators Formula.
Introduction to LabVIEW Seth Price Department of Chemical Engineering New Mexico Tech Rev. 10/5/14.
Concepts of Database Management Sixth Edition
1 Excel Lesson 3 Using Formulas and Functions Microsoft Office 2010 Fundamentals Story / Walls.
Programming – Touch Sensors Intro to Robotics. The Limit Switch When designing robotic arms there is always the chance the arm will move too far up or.
Mr. Wortzman. Tabs (Block Categories) Available Blocks Script Area Sprite Stage All sprites in this project.
JavaScript Events and Event Handlers 1 An event is an action that occurs within a Web browser or Web document. An event handler is a statement that tells.
Computer Science 1000 Spreadsheets II Permission to redistribute these slides is strictly prohibited without permission.
Introduction to LabVIEW
Chapter 3 Single-Table Queries
Microsoft Visual Basic 2008: Reloaded Fourth Edition
GIRLS Robotic Camp. Let’s Begin Meet and Greet – Camp leaders introduce themselves – Students introduce themselves.
Robotics NXT sensors Back to Light sensor: red vs blue ball.
Unit 5 – “Watch Out!”. Introduction New Topics Case Structures New Functions Less? Comparison Function Ultrasonic Sensor.
Ms. Deveny Second Semester  Introductions  Interview your table partner  Name  Why taking CPD  Computer experience  Favorite game?
Teacher/Mentor Institute Using easyC Joel Kirkland July 30-31, 2015.
ADVANCED EV3 PROGRAMMING LESSON
More switches, Comparison Day 7 Computer Programming through Robotics CPST 410 Summer 2009.
Concepts of Database Management Seventh Edition
Concepts of Database Management Seventh Edition
Chapter 5: More on the Selection Structure Programming with Microsoft Visual Basic 2005, Third Edition.
An Introduction to Programming with C++ Sixth Edition Chapter 7 The Repetition Structure.
Introduction to Data & Advanced Programming Blocks ROBOTICS II Module 1 Done by: Eng Nooran Drak.
Blue Tooth Communication ROBOTICS – ll MODULE 4. Set up a Bluetooth connection between two NXTs. Send/receive messages wirelessly using send/receive message.
Programming with Microsoft Visual Basic th Edition
Lesson Two: Everything You Need to Know
Introduction to Loops For Loops. Motivation for Using Loops So far, everything we’ve done in MATLAB, you could probably do by hand: Mathematical operations.
Robotics NXT-G: variables, file Rotation sensor Lab: Use buttons to hit specific ball. Homework: Postings. Start planning mapping the room.
XP 1 Microsoft Office Excel 2003 Working With Formulas and Functions.
Spreadsheets What is Excel?. Objectives 1. Identify the parts of the Excel Screen 2. Identify the functions of a spreadsheet 3. Identify how spreadsheets.
Programming with LabVIEW Intro to programming and.
1 An Introduction to R © 2009 Dan Nettleton. 2 Preliminaries Throughout these slides, red text indicates text that is typed at the R prompt or text that.
Module 3: Dealing with Files Robotics – ll. Objectives Understand the file access block and its configuration Create and use files inside NXT programs.
Data Hubs and Wires. Begin by adding a basic Move block, 5 rotations 75% power.
Mindstorm NXT-G Introduction Towson University Robotics.
An Introduction to Programming with C++ Sixth Edition Chapter 5 The Selection Structure.
Resource Review Excel formula basics Demonstrate how to enter manual formulas Examine some of the available functions and their usage Discuss the.
CONDITIONAL FORMATTING AND CUSTOM NUMBER FORMATS LEC 5 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.
ADVANCED EV3 PROGRAMMING LESSON By Seshan Brothers Random Block.
Python Programming Module 4 Sensors and Loops Python Programming, 2/e1.
Unit 2 Technology Systems
The Selection Structure
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Programming – Touch Sensors
Displaying sensor values while a robot is running
Sensors and Logic Switches
Loops with Multiple Sensor Controls
Controlling your quadcopter
By Sanjay and Arvind Seshan
INTERMEDIATE PROGRAMMING LESSON
Storing Values as Variables
INTERMEDIATE PROGRAMMING LESSON
Lecture 5 Binary Operation Boolean Logic. Binary Operations Addition Subtraction Multiplication Division.
CIS125GA Week 4 Logical Beginnings
Controlling your quadcopter
Presentation transcript:

Application of Data Programming Blocks

Objectives  Understand the use of data programming blocks and their applications  Understand the basic logic operations and apply them in programming robots.  Perform mathematical operations using the math block.  Control switches/loops using range and compare blocks  Create variables and constants.  Use the random block to personalize your robot

Data Blocks In this module we are going to study the configurations & applications of each block.

Math Block The Math Block is used to perform a mathematical operation on two input integer numbers. The result of the operation is available on an output data plug. The math operations are addition, subtraction, multiplication, and division. Using the math block, you can calculate the area of an object, the total distance travelled by the robot or modify a sensor reading to reflect the score in a pinball game Used to Calculate absolute value and square root.

Math Block Operation Output (Result) Input Numbers Configuration Panel Data Block A and B values can either be manually set in the configuration panel Or dynamically set with input data wires.

The variable block stores and retrieves variable values. You can save sensor readings in a variable and then update them after performing mathematical operations. For Example, you can count the total number of red or blue objects produced in a factory. Variable Block

Using variables in NXT-G is a two-step process. First you create the variable, and then you use the Variable block in your program to work with the data contained in the variable. Variable Block

2. Next, we can configure a Variable block to either read or write to the NumberVar variable that we created. Variable Block Variable Action WRITE Variable Action READ Variable Type

To do so, use the Configuration Panel to select the variable from the list, and then set the Action item to either Read or Write. When Read is selected, the variable’s current value is put on the data wire attached to the output data plug. When Write is selected, a value is stored in the variable. That value can be supplied either using the Configuration Panel or via an input data wire. Usually, you will need to use the Configuration Panel to set a variable’s initial value at the beginning of a program, and then use a data wire if you want to change the value later in the program.

This block can take up to three inputs. It determines whether a test number is inside or outside a range of numbers. It outputs a logic value depending on the result of the comparison. Range Block Test Value Lower Limit Upper Limit Output Result Range Value

This is the Configuration Panel for the range block. You can set the range by using the two-sided slider, by entering the values in the A and B boxes or by supplying the two range limit values using data wires. Using the slider, you can aselect lower and upper limits between 0 and 100. To use values greater than 100 or less than 0, enter the numbers in the boxes. The test value can be entered into the box on the Configuration Panel or supplied by using a data wire. Using the range block, you can improve on traditional color sorting codes by specifying a range values for each color Range Block

Lab Activity 1 Tasks 1 & 2

This block is designed to perform a logical operation on its inputs and output a true/false logical value. Its operations consist of,,, Logic Block Logic Operation Output Result Input conditions NOTAND Xor OR

The result of the Or operation will be true if either input value is true or if both input values are true. The result will be false only if both input values are false. Example: you want your robot to change direction if the ultrasonic value is less than 20 cm or the touch sensor is pressed. OR

The result of the And operation will be true only if both input values are true. If either input value is false, then the result will be false. Example: you want your car to operate when the ignition key is ON and all the doors are closed. AND

Xor is an abbreviation for Exclusive Or. This is similar to the Or operation except that the result is false if both input values are true. Example: you want your robot arm to pick either candy or ice cream but not both. Xor

This operation uses only the A input value and generates the opposite value. If the input value is true, then the output value will be false, and if the input value is false, then the output value will be true. NOT

Logical operations are often described using a table that lists all the possible input values and the result for each operation. This is called a truth table

1. You select the operation you want to perform. 2. Supply the Input values, using either data wires OR the configuration Panel Logic Block: Configuration Panel Buttons are used to set the values in the Configuration Panel, with the (√) meaning true and the (x) meaning false.

Lab Activity 1 Task 3

Constant Block is used to access constants in your program. This block looks like the Variable block, with a lock added to show that the value cannot be changed Constant Block Constant Name Constant Type

Constant Block: Configuration Panel The Action item determines how you will define the value to use, either selecting a constant from the list created using the Edit define constants dialog OR creating a custom constant The Data type can be logic, text or number. You can set the name and the value of the constant block by entering the values in the configuration panel. The name of the constant will be shown on the block To use the constant value, simply connect a data wire to the Constant block’s output data plug.

This block simply compares two numbers as to whether or not the first number is greater than, less than, or equal to the second number. It outputs a logic value depending on the result of the comparison. Compare Block Input Numbers Comparison Operation Output Result When the block runs; it takes the two input numbers, compares them, and puts the resulting logic value on the output data wire. For example, if the A value is 7 and the B value is 12, the result will be true, because 7 is less than 12. On the other hand, if A is 25 and B is 8, the result will be false, because 25 is not less than 8.

You can supply the two input values using data wires or the Configuration Panel. Using the compare block, you can compare the readings from two ultrasonic sensors. You can then use the result of the comparison to control a Switch or Loop block to determine which way your robot should go.

Random Block is used to generate a random number. It takes two inputs in the form of the min and max values of the random numbers it will be allowed to generate. It is used to create robotic games or a robot that exhibits unpredictable behavior because the block’s output will vary each time the program runs. Often a robot that is a little unpredictable can be more interesting or seem to have more personality. Random Block Lower Limit Upper Limit Random Number (Min and Maximum)

Random Block Like the range block, you can set the range by using the two- sided slider, by entering the values in the A and B boxes, or by supplying the two range limit values using data wires. Using the slider, you can select lower and upper limits between 0 and 100. To use values greater than 100 or less than 0, enter the numbers in the boxes. The minimum value for the lower limit is 0 while the maximum value for the upper limit is

Lab Activity 2

Review Questions