Robots Week 3a Programming Lesson 2: Modifiers, Loops and Jumps Programming Solutions.

Slides:



Advertisements
Similar presentations
1chung Robofest 2005 RCX code Workshop Jan 29, 2005 CJ Chung.
Advertisements

Robofest 2005 Introduction to Programming RIS 2.0 RCX Code.
Chung for Robofest 05 1 Introduction to RoboLab CJ Chung Lawrence Technological University.
Introduction to LEGO RCX robotics and Robot Sumo
Dublin Robotics Boosters NXT-Step Programming Workshop.
Sensors For Robotics Robotics Academy All Rights Reserved.
Automation and Robotics
VEX and Robot C Chris Patterson Presented by Modified by J. Andazola.
De la Rosa-Pohl ECE 1100 Introduction to Engineering Intro to LabVIEW: Programming for Symon University of Houston Diana de la Rosa-Pohl Len Trombetta.
Using the NXT Light Sensor. 2 Connect One Light Sensor – 1 From My Files use Left / Right NXT buttons and get to View menu and push Orange button. From.
NXTG Workshop for Bottle RoboSumo Lawrence Technological University.
MatLab – Palm Chapter 4, Part 3 For and While Loops
An Intro to Robots and Computer Programming
1 Lecture 5  More flow control structures  for  do  continue  break  switch  Structured programming  Common programming errors and tips  Readings:
1 ©2006 INSciTE Lab Two Task: Make the program from Lab One (Move forward 5 rotations and turn right 90 degrees) into a MyBlock.
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.
Testbed: Exercises.
MIDI Lesson with easy beat Sequencing a MIDI file to use with improvisation activities in the middle school music class.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley This week: Whew!!! The last homework was tough! The homework for this week.
Introduction to LabVIEW
Creative Inventions and Robotics Programming with Robolab By Rebekah Gendron.
GIRLS Robotic Camp. Let’s Begin Meet and Greet – Camp leaders introduce themselves – Students introduce themselves.
Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.
LabVIEW Program and Data Flow Review LabVIEW Robotics Fundamentals.
CSC Intro. to Computing Lecture 16: Robotran.
LabVIEW Basics Review LabVIEW Robotics Fundamentals.
Programming a light sensor to follow a black line.
Using Waits, Loops and Switches WAIT please!. Waits, Loops and Switches Pre-Quiz 1. In programming, what is a loop? When is a loop useful? 2. How can.
Robotics Overview of NXT-G Actuators in Mindstorms. Touch sensor Labwork: Right turn. Touch/bump. [Explore move versus Motor Move mini & motor mini. Motor*.]
Motors and Sound Troubleshooting Tips. © H-CCS Problem 1 Why can’t I download my program to the RCX?
Vex Robotics Program six: combining autonomous and radio control.
3 | Touch sensors Created by H. Robinson & A. Gostelow TOUCH SENSORS.
ENGR 101: Robotics Lecture 4 – Making Decisions Outline  The Stall Sensor  Making Decisions  Random Number Generation References 
By Eric Greene RMS / I. S. 192 Q. Smart Start Question How would you get the robot to flirt with disaster by touching the edge of the “table” as many.
Lesson 4: Conditional Statements Programming Solutions.
Vex Robotics Program four: reversing and turning.
Oregon Robotics Tournament and Outreach Program RCX Basics.
What’s in the Box?
Programming 101 The Common Palette Content provided by Connor Statham (9 th Grade Student) Formatting by Shannon Sieber.
ROBOTC Software EV3 Robot Workshop
BEGINNER FLL PROGRAMMING WORKSHOP BY DROIDS ROBOTICS & EV3LESSONS.
ROBOTC Software EV3 Robot Workshop Lawrence Technological University.
Lesson 1: Motors and Sound Programming Solutions.
Vex Robotics Program Two: Using two motors. Program two: using the motors In the last section, you learned how to turn on one motor. Now, you will take.
How to make a Line Follow program Using EV3 software and an NXT light sensor.
Obstacle Detection. In the previous program the robot moves forward and then checks for something in the way. As we observed it only checks for things.
Automation and Robotics.  First you select the platform type so that you can use Natural Language PLTW.
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.
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.
4 |Multitasking Created by H. Robinson & A. Gostelow Multitasking.
ROBOTC for CORTEX Teacher Training © 2011 Project Lead The Way, Inc. Automation and Robotics VEX.
BEGINNER PROGRAMMING LESSON
Week 3 DO NOW QUESTIONS.
Scratch: iteration / repetition / loops
INTERMEDIATE PROGRAMMING LESSON
Automation and Robotics
An Introduction to VEX IQ Programming with Modkit
An Introduction to VEX IQ Programming with Modkit
Lesson 3: Sensor Wait-for’s Programming Solutions
if-else Structures Principles of Engineering
An Introduction to VEX IQ Programming with Modkit
Using the sensor Lesson 5.
Systems of Linear Equations: An Introduction
Obstacle Detection.
Lego MINDSTORMS EV3.
Oregon Robotics Tournament and Outreach Program
Enum.
Implementing Variables in Your Programs
Presentation transcript:

Robots Week 3a Programming Lesson 2: Modifiers, Loops and Jumps Programming Solutions

Exercise 1: Solution Play a beep for a random number of times. Put the Play Sound icon in a loop The dice modifier gives a random number

Exercise 2: Solution Turn on motor A in the forward direction at power level 1 for 1 second, then on power level 2 for 1 second, etc. Continue this pattern up to power level 5 for 1 second, then stop the motor.

Exercise 3: Solution Turn on motor A in the forward direction for 3 seconds, then stop the motor. Then turn on motor C in the forward direction for 3 seconds, then stop the motor. Repeat this forever. To get 3 seconds, you need a numeric constant modifier When the program reaches here... …it jumps back to here. This makes it repeat forever.

Lesson 2: Modifiers, Loops and Jumps Troubleshooting Tips

Problem 2a Write a program that plays a beep three times in a row. This plays sound #3, NOT 3 sounds.

Solution(s) 2a Use 3 Play Sound icons, or use a loop that loops 3 times.

Problem 2b Turn on motor A at power level 1. This is a numeric constant modifier NOT a power level modifier. (Strangely enough, it does not show a bad wire. Hmmmm…..)

Solution 2b Use a Power Level 1 modifier.

Problem 2c Write a program that beeps forever. What’s wrong? This is a yellow jumpBut this is a red land

Solution 2c Make sure jump and land pairs are the same color.

Problem 2d Write a program that beeps forever. What’s wrong now? Start Jump to green land Land hereEnd Oops!

Solution 2d Be careful not to mix up the order of your jumps and lands!

Jumps  Jumps are like GoTo commands in other languages.  Program “jumps” on up arrow and “lands” on down arrow.  Can create a loop. But it makes an infinite loop, which goes on forever.  It is better to use the loop command for that and to use jumps with forks.

Loops  Loops are conditionals (“if” statements).  They allow you to repeat sections of your program over and over.  All start with a start loop command.  All terminate with an end loop command.  Can specify the number of times to repeat.  Default is to loop twice.  Can nest loops.

Forks  Forks are equivalent to “if-then-else” in other languages.  All fork commands require a merge fork be used later. (like end if)  All use a greater than/less than condition.  You must wire a threshold value.  Touch sensors do not require a threshold, they are just pushed in or not.

Equal forks  Icon on the far right of the forks sub- menu.  Equal forks are the same as standard forks but the conditional statement is “equal to/not equal to” instead of “greaterthan/less than”

Tips  Displaying data to the LCD panel is a common way of debugging a program.