Automation with RobotC

Slides:



Advertisements
Similar presentations
While Loops and If-Else Structures
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
VEX and Robot C Chris Patterson Presented by Modified by J. Andazola.
Developed in collaboration with Introduction to Programming.
Photos and Sensor Instructions
Testbed: Exercises.
ROBOTC Software Introduction. ROBOTC Software ROBOTC developed specifically for classrooms and competitions Complete programming solution for VEX Cortex.
Coding for the FIRST Tech Challenge: RobotC
AUTOMATION AND PROGRAMMING SOME GET STARTED TIPS… Everyone please log into RobotC !
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.
AUTOMATION WITH ROBOTC Starting to write and troubleshoot computer code.
Photos and Sensor Instructions
ROBOTC for CORTEX.
Vex Robotics Program four: reversing and turning.
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.
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 Online Professional Development
ROBOTC for VEX On-Site Professional Development
Robotics Programming Using Shaft Encoders
ROBOTC for VEX Online Professional Development
Automation and Robotics
Programming Design ROBOTC Software Computer Integrated Manufacturing
RobotC Sensors.
Automation and Robotics
TECH 1 BAMS Technology Education
While Loops and If-Else Structures
Getting Started in RobotC
Programming Basics - RobotC
While Loops and If-Else Structures
Lesson 3: Sensor Wait-for’s Programming Solutions
Automation and Programming
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
if-else Structures Principles of Engineering
Robotics Programming Using Shaft Encoders
Photos and Sensor Instructions
Robotics Programming Using Shaft Encoders
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 GTT kits do not include Servo motors – so make sure students do not use that option. Commands that allow you to control individual motors

Special Commands that control the more unique VEX Hardware – LED’s and Flashlights Flashlights not in GTT kits.

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 Presentation Name Course Name Unit # – Lesson #.# – Lesson Name 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? Encourage students to read the error descriptions for suggestions on how to fix their program. Once errors are fixed. Compile, download and run the program again. Line 31 – closing parenthesis is in wrong place – goes after the -63)

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 BUMP SWITCH LIMIT SWITCH Digital Switches are either ON or OFF. The command that will always work for these switches is “untilBump” BUMP SWITCH LIMIT SWITCH

Press the bump switch to turn off the second motor. Presentation Name Your warm up Program Course Name Unit # – Lesson #.# – Lesson Name Write a program so that a motor turns on when the limit switch is pressed. After 2 ½ seconds have that motor turn off and the other motor turn on in the opposite direction Press the bump switch to turn off the second motor. Have students try to solve this without showing the sample solution first.

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

Potentiometer Program Answer task main() { untilPotentiometerGreaterThan(3500, in2); startMotor(rightMotor, 127); waitInMilliseconds(3000); stopMotor(rightMotor); }

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.

Line tracker Program Answer task main() { startMotor(rightMotor, 127); untillight(100, in1); stopMotor(rightMotor); }

Open System An open system will let you unplug your cortex from the computer and run your program repeated times.