AUTOMATION WITH ROBOTC Starting to write and troubleshoot computer code.

Slides:



Advertisements
Similar presentations
ROBOTC for CORTEX While Loops Part 1
Advertisements

While Loops and If-Else Structures
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.
VEX/ROBOTC Session 1.
Automation and Robotics
VEX and Robot C Chris Patterson Presented by Modified by J. Andazola.
Developed in collaboration with Introduction to Programming.
Photos and Sensor Instructions
Autonomy using Encoders Intro to Robotics. Goal Our new task is to navigate a labyrinth. But this time we will NOT use motor commands in conjunction with.
Introduction to Sensors
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 for VEX Online Professional Development
ROBOTC Software Introduction. ROBOTC Software ROBOTC developed specifically for classrooms and competitions Complete programming solution for VEX Cortex.
ROBOTC for VEX On-Site Professional Development
Programming Design ROBOTC Software Principles of Engineering
Robot C and Natural Language
Technical Writing for Robotic Coding!.  du/products/teaching_robotc_cort ex/fundamentals/introtoprogramm ing/thinking/videos/fundamentals.
Photos and Sensor Instructions
ROBOTC for CORTEX.
Vex Robotics Program four: reversing and turning.
While and If-Else Loops ROBOTC Software. While Loops While loop is a structure within ROBOTC Allows a section of code to be repeated as long as a certain.
Automated Mechanisms Help. Potentiometers Potentiometer Check –Analog Port 2 How they work –Analog sensor –Measures rotation of a shaft between 0 and.
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.
VEX and Robot C Chris Patterson Frisco ISD CTE Center Presented by.
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.
ROBOTC for CORTEX Teacher Training. ROBOTC Overview Thinking about Programming.
ROBOTC for Testbed © 2011 Project Lead The Way, Inc.Automation and Robotics VEX.
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.
Robot C and Natural Language. Create a folder Create a folder on your desktop to insert all your Robot C files, Here you will begin with your template.
ROBOTC for CORTEX Teacher Training © 2011 Project Lead The Way, Inc.Automation and Robotics VEX.
ROBOTC for VEX Online Professional Development. Homework Questions Thoughts? Questions?
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.
Programming Design ROBOTC Software. Behavior-Based Programming A behavior is anything your robot does –Turning on a single motor or servo Three main types.
Basic Programming: Until Commands. The Problem with Wait States Motor Speed is affected by battery power. –If the battery is fully charged, the motors.
Robotics Programming Wall Follow Line tracking for a set amount of time Line tracking for a distance.
Decision Making: while loops and Boolean Logic. While Loops A while loop is a structure within ROBOTC which allows a section of code to be repeated as.
Sensor Information: while loops and Boolean Logic.
ROBOTC for CORTEX Teacher Training © 2011 Project Lead The Way, Inc. Automation and Robotics VEX.
After Construction Name: Per #:.
Programming Design ROBOTC Software Principles Of Engineering
Automation with RobotC
INTRODUCTION TO ROBOTICS Part 5: Programming
ROBOTC for VEX Online Professional Development
Introduction to Programming
ROBOTC for VEX On-Site Professional Development
ROBOTC for VEX Online Professional Development
Automation and Robotics
Programming Design ROBOTC Software Computer Integrated Manufacturing
RobotC Sensors.
RobotC Sensors.
Automation and Robotics
TECH 1 BAMS Technology Education
Getting Started in RobotC
While Loops and If-Else Structures
Programming Design ROBOTC Software Principles Of Engineering
While Loops and If-Else Structures
While Loops and If-Else Structures
While Loops and If-Else Structures
VEX Robotics In The Classroom
Automation with RobotC
Robotics Programming Using Shaft Encoders
Photos and Sensor Instructions
While Loops and If-Else Structures
Automation with RobotC
Robotics Programming Using Shaft Encoders
While Loops and If-Else Structures
Programming Design ROBOTC Software Principles of Engineering
While Loops And If-Else Structures
Presentation transcript:

AUTOMATION WITH ROBOTC Starting to write and troubleshoot computer code

OPEN A NEW FILE

REVIEW OF ROBOT C  When you open a new file in Robot C, you must go to the “MOTORS and SENSORS SETUP” page before you write your code

REVIEW OF ROBOT C  Once your new file is open, remember that your program code always needs to be written between the two curly brackets on the screen

NATURAL LANGUAGE COMMANDS  We will only use 4 of the Natural Language commands when we program, but each of these commands has a number of choices

MOVEMENT  Commands that allow you to control individual motors

SPECIAL  Commands that control the more unique VEX Hardware – LED’s and Flashlights

UNTIL  Commands that allow you to create behaviors where the robot acts “until” a certain event. For example,  Button Press  Potentiometer Value

WAIT  Commands that wait for an elapsed amount of time. The next command will run after the timer is done.

ROBOTC PRACTICE PROGRAM You may notice warnings or errors.  Make sure you spell motor and sensor names exactly as defined in Motors and Sensors setup.  A ; is needed at the end of each line of code.  Don’t forget every open parenthesis needs a closing parenthesis.  What is wrong with line 31?

WHAT’S WRONG WITH THIS CODE?  Missing the semicolon.

WHY WON’T THE MOTOR STOP?  Should say “leftMotor”, not “rightMotor”.

WHY WON’T THE LED TURN ON?  There is nothing between the “Turn on” and “Turn Off” commands, so the LED doesn’t stay on at all.

DIGITAL SWITCHES  Digital Switches are either ON or OFF. The command that will always work for these switches is “untilBump” LIMIT SWITCH BUMP SWITCH

YOUR WARM UP PROGRAM 1. Write a program so that a motor turns on when the limit switch is pressed. 2. After 2 ½ seconds have that motor turn off and the other motor turn on in the opposite direction 3. Press the bump switch to turn off the second motor.

PRACTICE PROGRAM ANSWER

ANALOG SWITCHES  The Potentiometer and Line Tracker work on a scale of 0 – 4095 POTENTIOMETER LINE TRACKER

POTENTIOMETER  The Potentiometer works on a scale of 0 – 4095  It is very sensitive, and it is NOT meant to turn all the way around, so please don’t force it!

POTENTIOMETER  Position = a number between 0 and 4095  sensorPort = in2 or potentiometer

ANALOG SWITCHES  Write a code for the potentiometer that turns on a motor for 3 seconds when you turn it past 3500 POTENTIOMETER

task main() { untilPotentiometerGreaterThan(3500, in2); startMotor(rightMotor, 127); waitInMilliseconds(3000); stopMotor(rightMotor); } POTENTIOMETER PROGRAM ANSWER

ROBOTC DEBUGGER  When I write a code with a potentiometer, I need to see what the sensor is reading right now. We do this by looking at a “Debugger” window.

ROBOTC DEBUGGER  After you click on “Compile Program”, open the Sensor Debug window by going to Robot > Debug Windows > Sensors

LINE TRACKER  Position = a number between 0 and 4095  sensorPort = in1 or lineTracker

LINE TRACKER  The line tracker senses light and dark.  Right a program that turns on a motor, and has it stop when you cover the line tracker with your finger.

task main() { startMotor(rightMotor, 127); untillight(100, in1); stopMotor(rightMotor); } LINE TRACKER PROGRAM ANSWER

OPEN SYSTEM  An open system will let you unplug your cortex from the computer and run your program repeated times.