Vex Robotics program three: using motors and sensors together.

Slides:



Advertisements
Similar presentations
Vex Robotics Program five: using the radio control transmitter.
Advertisements

Jason Howard. Agenda I. How to download robotc II. What is tele-op used for? III. How to build a basic tele-op program IV. Getting the robot to drive.
Automation and Robotics
Developed in collaboration with Introduction to Programming.
Vex Robotics Introduction to Sensors. introduction to sensors Sensors assist robots in seeing and feeling the physical world through which they travel.
Programing Concept Ken Youssefi/Ping HsuIntroduction to Engineering – E10 1 ENGR 10 Introduction to Engineering (Part A)
Available at: – Program Optical Quad Encoders in Autonomous Mode Program optical quad encoders in autonomous mode.
Vex 1.0 © 2005 Carnegie Mellon Robotics Academy Inc. Programming in easyC.
CS 1 with Robots IDLE and Myro Institute for Personal Robots in Education (IPRE)‏
Introduction to Sensors
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.
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.
What is RobotC?!?! Team 2425 Hydra. Overview What is RobotC What is RobotC used for What you need to program a robot How a robot program works Framework.
ROBOTC Software Introduction. ROBOTC Software ROBOTC developed specifically for classrooms and competitions Complete programming solution for VEX Cortex.
Program ultrasonic range sensor in autonomous mode
Programming Concepts (Part B) ENGR 10 Introduction to Engineering 1 Hsu/Youssefi.
Available at: Lesson 3.6 – Program Line Follower in Autonomous Mode Program Line Follower in Autonomous Mode.
Teacher/Mentor Institute Using easyC Joel Kirkland July 30-31, 2015.
Programing Concept Ken Youssefi/Ping HsuIntroduction to Engineering – E10 1 ENGR 10 Introduction to Engineering (Part A)
EasyC Programming Workshop January 30, 2008 Hauppauge High School SPBLI - FIRST Mark McLeod Advisor Hauppauge Team 358 Northrop Grumman Corp.
Vex Robotics Programming Sequence. Now that you’ve had some practice downloading and using the included programs, it's time to learn to write some of.
7.2 V battery pack and charger Put the battery in the charger station at the end of the lab. period. Red light indicates charging. Ken Youssefi Introduction.
Vex Robotics Programming Options. To start you off and give you a safe "home base" to return to while you explore, a few key programs are already included.
Available at: Lesson 3.5 – Program Light Sensor in Autonomous Mode Program Light Sensor in Autonomous Mode.
Vex Robotics Program six: combining autonomous and radio control.
Real-Time Data through Data Hubs. Begin by adding a basic Move block, 5 rotations 75% power.
Created by Blake Ross Start EasyC. Created by Blake Ross.
Teacher/Mentor Institute Using easyC David Dominguez June 2, 2015 Update Version.
Vex Robotics Program four: reversing and turning.
Programming - Motion Intro to Robotics. Motors and Sensors Setup The first thing we need to do is tell ROBOTC that we have motors on our robot. Choose.
Available at: – Program Functions for VEX Robots Program Functions for VEX Robots.
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.
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.
Mechanical Components and Programming Ken Youssefi Introduction to Engineering – E10 1.
Testbed Coding In this activity you will code different challenges for the Testbed. For each challenge a sample program is shown. Use what this sample.
Project Overview  Introduction  Clawbot Build  Design Modification  Design Development  Programming  Sensors  Advanced Sensors  Open design challenges.
Testbed Coding In this activity you will code different challenges for the Testbed. For each challenge a sample program is shown. Use what this sample.
Robotics Programming Wall Follow Line tracking for a set amount of time Line tracking for a distance.
Teacher/Mentor Institute Intro to easyC Programming Scott McEwen July 21-22, 2016.
ROBOTC for CORTEX Teacher Training © 2011 Project Lead The Way, Inc. Automation and Robotics VEX.
Robotics Education & Competition Foundation
Introduction to Programming in RobotC
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Advanced EasyC Jim Cline July 20-21, 2017.
Robotics Programming Using Shaft Encoders
Project Overview Introduction Clawbot Build Design Modification
Automation and Robotics
Programming Part 2 Mod Kit
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Basics for Robotics Programming
Movement using Shaft Encoders
Programming – Touch Sensors
RobotC Sensors.
Automation and Robotics
While Loops and If-Else Structures
Programming Autonomy By Joshua Shaw.
Line Following Behavior
Switch Blocks check a value and choose a path based on that value
Storing Values as Variables
Line Following Behavior
Programming - Buttons Intro to Robotics.
Robotics Programming Using Shaft Encoders
Programming - Buttons Intro to Robotics.
Robotics Programming Using Shaft Encoders
Robotics Programming Using Shaft Encoders
Obstacle Detection.
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Presentation transcript:

Vex Robotics program three: using motors and sensors together

Program three: using motors and sensors together This program will make your robot move forward forever, unless the bump sensor is pushed in.

Start a new project in easyC by clicking New Project" in the "File" menu.

Double-click the Variables block in your program to open the "Variables" window. Create a new "int" type variable named "bumper", then click OK.

In the "Function Block" window, under the "Program Flow" heading, find the "While Loop" icon. Left-click on the icon and drag it into the program window and drop it between the begin and end icons.

The "While Loop" configuration menu 4 will appear. Set the condition of the while loop to be "1==1". This has the same effect as using a variable set to 1, like in the sample bump sensor code. Click "OK". The while loop will loop for an infinite amount of time.

Your program should now look like this.

In the "Function Block" window, under the "Inputs" Heading, find the "Bumper Switch" icon and drag this into the program window between the { and } brackets of the while loop. Set the "Digital Input #" to 6 (where the front bumper switch is plugged in, see page 33 for setup details), and the "Retrieve to" to the variable you created, "bumper". Click OK when you are done. You have now set the variable "bumper" to be updated with the current value of the bump sensor each time the loop is run.

If the bump sensor is not pushed in, then you want the motors to continue moving the robot forward. If the bump sensor is pushed in, then you want the robot to stop. Since we are storing the bumper sensor's pushed/notpushed state in the "bumper" variable, that is where the program must look to see whether it is being pushed. If the sensor is pushed, "bumper" will have a value of 0. If it is not pushed, "bumper" will be equal to 1. We will use an if-else statement to perform this check.

In the "Function Block" window, under the "Program Flow" heading, drag the "If" block into the while loop underneath the "Bumper Switch" icon. In the "If“ configuration window, the first block asks you to define the condition (just like a while loop). First, click the small arrow next to "Add Variable" and select "Bumper". Then, click the arrow next to "Add Operator" and select the "==" operation. After the "==" sign, you will enter the number 1. The “if” condition will now check whether the variable "bumper" is equal to 1. Click OK to continue.

Similarly, drag the Else block below the If block. Your code should look like the program on the left. Now, recall that if the bump sensor is not being pressed in (that is, bumper is equal to 1), we want the robot to move forward. You already know which combination of icons makes your robot move forward (refer to program two if you need a reminder).

Drag in two motor modules between the brackets under the "if" statement. Set them up so that your robot will drive forward. Be sure to place the move- forward motor commands in the section immediately after “if (bumper==1)” because you want them to execute when bumper is equal to 1.

The other half of this program's behavior is that if the bumper is being pressed in, we want the motors to stop. Drag in two motor modules between the brackets under the "else" statement. Configure them so that they form a stopping behavior.

Check your code to make sure it looks like the code on the right. Compile and download your code.