Motor control drive in circles Pragmas configure motors Turning right in function of time Turning left in function of time Main program starts from here.

Slides:



Advertisements
Similar presentations
Lab7: Introduction to Arduino
Advertisements

An Introduction to C Adam Gleitman – IAP 2014.
Team 5220 Roboknights. Outline  Getting Started  Hardware Setup/Wiring  Software Setup/Pragmas  Programming with RobotC  Grammar/Syntax  Basic Statements.
Graphical RobotC NXT (EV3) Robot Workshop 2015 Instructor: Dr. Fred Brauchler Assistant: Chris Parker 2/7/2015Lawrence Technological University1.
V EX C OACHES ' T RAINING October 12, Agenda for Today 9 – 10 AM : Tina Reeves and the Engineering Notebook 10 – Noon : Finish Building, Basic Robot.
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.
EIGHTH GRADE ROBOTICS KITTATINNY REGIONAL HIGH SCHOOL MR. SHEA Introduction to Programming
RobotC – A Tutorial II Show: to capture interest.
CS 1 with Robots Robot Sensors & Actuators Institute for Personal Robots in Education (IPRE)‏
Differences between Java and C CS-2303, C-Term Differences between Java and C CS-2303, System Programming Concepts (Slides include materials from.
RobotC Programming for LEGO Mindstorms NXT Carnegie Mellon Dacta Lego Timothy Friez Miha Štajdohar SOURCES:
IR SENSORS AND ENCODERS. LCDs Timothy Friez Class # 2.
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.
RobotC For Beginners Tyler Lutz and Keaton Bonds DRSS Enterprise.
Reviewing Common Blocks for St. Agnes Elementary School Teachers by Jenny Chang Feb. 26th, 2007 USC & University Neighborhood Outreach Robotics STEM program.
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.
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.
Wednesday Program Flow
ROBOTC Software Introduction. ROBOTC Software ROBOTC developed specifically for classrooms and competitions Complete programming solution for VEX Cortex.
Java for Robots How to program an NXT robot with a Java Brain Bert G. Wachsmuth Seton Hall University.
Review Blocks of code {.. A bunch of ‘statements’; } Structured programming Learning Processing: Slides by Don Smith 1.
11 Chapter 3 DECISION STRUCTURES CONT’D. 22 FORMATTING FLOATING-POINT VALUES WITH THE DecimalFormat CLASS We can use the DecimalFormat class to control.
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.
ROBOTC for VEX On-Site Professional Development
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Introduction to Robo Pro
RobotC Advanced Concepts SSI Robotics September 7, 2013 Capitol College.
Gauge Operation and Software by Scott A. Ager. Computer Recommendations 750 MHz Pentium III 64 Meg SRAM 40 Gig Hard Drive 1024 x 768 graphics CD Writer.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 7 The Game Loop and Animation Starting Out with Games & Graphics.
Robotics Light sensor. Calibration. Reverse engineering challenge. Lab work: Create and show your program. Add light sensor (different orientations). Robot.
NXC (and NBC) NXC (Not eXactly C) is a language similar to NQC, which was the most popular way to program the RCX Built on NBC, the Next Byte Code ‘assembler’
Engineering 1040: Mechanisms & Electric Circuits Winter 2015 Introduction to C Programming.
Wall Encounter By Made easy by Dwayne Abuel.
Lego MindStorm An Introduction to Blocks. Blocks Blocks are used to give instructions to your robot. There are many types of blocks You can use the blocks.
ENGR 101: Robotics Lecture 4 – Making Decisions Outline  The Stall Sensor  Making Decisions  Random Number Generation References 
Castor Bot. Now, we will begin creating a robot Log onto your computer On your screen, click on the website labeled “castor bot” Your building instructions.
Robotics NXT-G: variables, file Rotation sensor Lab: Use buttons to hit specific ball. Homework: Postings. Start planning mapping the room.
NQC / BricxCC Brief Introduction David Schilling.
LEGO® MINDSTORMS® NXT Move Block.
Variables and Functions ROBOTC Software © 2012 Project Lead The Way, Inc.Principles of Engineering.
Automated Mechanisms Help. Potentiometers Potentiometer Check –Analog Port 2 How they work –Analog sensor –Measures rotation of a shaft between 0 and.
Programming 101 The Common Palette Content provided by Connor Statham (9 th Grade Student) Formatting by Shannon Sieber.
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.
Mindstorm NXT-G Introduction Towson University Robotics.
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.
Vex Robotics program three: using motors and sensors together.
Programming VEX Cortex Robotics with ROBOTC
MEH108 - Intro. To Engineering Applications KOU Electronics and Communications Engineering.
NXT File System Just like we’re able to store multiple programs and sound files to the NXT, we can store text files that contain information we specify.
ROBOTC for VEX Online Professional Development. Homework Questions Thoughts? Questions?
KM SERIES VENDING MACHINES OPERATION MANUAL. ARM Main board & Driver Board DRIVING BOARD MAIN BOARD.
Introduction to Programming in RobotC
Variables and Functions
Introduction to Gobbit Programming
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Movement using Shaft Encoders
Using Encoders to go Straight
Variables and Functions
Variables and Functions
Module F: Presentation Understanding Robot Fundamentals
Variables and Functions
Controlling your quadcopter
Storing Values as Variables
Robotics Programming Using Shaft Encoders
Robotics Week 4 Functions and reusable code
EXPRESSIONS, PAUSES AND SOUNDS
RobotC Programming for LEGO Mindstorms NXT
Compiled from various Internet sources Presented by Mr. Hatfield
Controlling your quadcopter
Presentation transcript:

Motor control drive in circles Pragmas configure motors Turning right in function of time Turning left in function of time Main program starts from here

Increase right motor speed Motor control drive in circles Decrease left motor speed

Testing right and left turns

Basic motor control commands, plus some fine-tuning commands. motor[output] = power; NXT Turn the referenced NXT motor output either on or off and also sets the power level of the motor outputs. The NXT has 3 motor outputs: motorA, motorB, motorC The NXT can handle power levels from -100 (full reverse) to 100 (full forward). A power level of 0 will cause the motors to stop. motor[motorA] = 100; //Output A - full speed forward motor[motorB] = 100; //Output B - full speed forward

bMotorFlippedMode[output] = 1 or 0; NXT This feature is used to reverse the direction the referenced motor travels. Once this setting is changed, the reference motor will be reversed for the entire program (unless manually changed a later point in the program) This is useful for when working with motors that mounted in different directions and the programmer wants to keep the power setting the same for both motors. There are two settings: 0 - normal, 1 - reversed

bFloatDuringInactiveMotorPWM = true or false; NXT This switch is used to choose whether the motors on the NXT will float or brake when there is no power applied. By default, the motors will float. The reason to switch this is if you're trying to make precise turns with the NXT and the motors are drifting causing the change in direction to be off. There are two settings for this switch: false - motors will brake when inactive true - motors will float when inactive bFloatDuringInactiveMotorPWM = false; //motors will brake when power is set to "0"

Timers The NXT allows you to use Wait commands to place delays in your program. It also supports Timers, which work like stopwatches - they count time since the last reset, and you reset them again when you want to start or restart. wait1Msec(wait_time); NXT This function will cause a program to wait a specified number of milliseconds before executing the next instruction in a program. Wait_time is an integer (1 = 1/1000th of a second). Maximum wait time is seconds when using this function.

wait10Msec(wait_time); NXT This function will cause a program to wait a specified number of hundredths of a second before executing the next instruction in a program. Wait_time is an integer (1 = 1/100th of a second). Maximum wait time is seconds when using this function. motor[motorA] = 100; //Output A - full speed forward wait10Msec(200); //Wait 2 seconds motor[motorA] = 0; //Output A - off

time1[timer] = time; NXTThis timer function returns the current value of the referenced timer as an integer in a specific resolution. The resolution for "time10" is in milliseconds (1 = 1/1000th of a second). The maximum amount of time to be recorded is seconds (~1/2 minute) The NXT has 4 internal timers: T1, T2, T3, T4 int x; //Init variable x x = time1[T1]; //assign variable x value of Timer #1 (1/1000th seconds)

time10[timer] = time; NXTThis timer function returns the current value of the referenced timer as an integer in a specific resolution. The resolution for "time10" is in hundredths of a second (1 = 1/100th of a second). The maximum amount of time to be recorded is seconds (~5 minutes) The NXT has 4 internal timers: T1, T2, T3, T4 int x; //Init variable x x = time10[T1]; //assign variable x value of Timer #1 (1/100th seconds)

time100[timer] = time; NXTThis timer function returns the current value of the referenced timer as an integer in a specific resolution. The resolution for "time100" is in tenths of a second (1 = 1/10th of a second). The maximum amount of time to be recorded is seconds (~54 minutes) The NXT has 4 internal timers: T1, T2, T3, T4 int x; //Init variable x x = time100[T1]; //assign variable x value of Timer #1 (1/10th seconds)

ClearTimer(timer);NXTResets the referenced timer back to zero seconds. The NXT has 4 internal timers: T1, T2, T3, T4 ClearTimer(T1); //Clear Timer #1

Sensors Sensor commands for configuration and usage are listed below. Most sensor setup should be done through the Robot > Motors and Sensors Setup menu for best results. SetSensorType(sensor_input,sensor_type);NXTThis function is used to manually set the mode of a specific input port to a specific type of sensor. We recommend, however, that you use the "Motor and Sensors Setup" wizard in RobotC. The NXT has 4 sensor inputs: S1, S2, S3, S4 The NXT supports 8 different types of sensors:

SensorValue(sensor_input)NXTSensorValue is used to read the value of the referenced sensor port. Values will correspond to the type of sensor set for that port (see set_sensor_type page). The SensorValue function can be accessed like a variable, as it returns an integer value. The NXT has 3 sensor inputs: S1, S2, S3, S4

nMotorEncoder[motor] NXTThis function is used to access the internal encoder from the NXT's motors. A value is return with the number of degrees the motor has traveled (1 = 1 degree), with the value as an integer.

ClearSensorValue(sensor_input)NXTThis function is used to reset the value of the referenced sensor port back to zero. This is only neccessary with specific sensor types that retain their values (e.g. Encoder Sensor). The NXT has 4 sensor inputs: S1, S2, S3, S4 SetSensorType(S1, sensorRotation); //Input #1 now is set to be a Rotation Sensor ClearSensorValue(S1); //Reset Input #1 back to a value of 0

Sounds The NXT can generate tones, or play back stored waveform sound data. PlayTone(frequency, duration)NXTPlays a sound from the NXT internal speaker at a specific frequency (1 = 1 hertz) for a specific length (1 = 1/100th of a second). PlayTone(220, 500); //Plays a 220hz tone for 1/2 second

PlaySoundFile(file_name);NXTThis function is used to play a sound file that is on the NXT. NXT sounds files have the extension.rso. PlaySoundFile(Whoops.rso); //Plays the sound file "Woops.rso"

LCD Display Commands for the NXT's LCD Display. nxtDisplayTextLine(line_number, text, var1, var2, var3); NXTDisplays a text line on the LCD screen of the NXT. Up to three variables are passable to the function. line_number - The line the text line will appear on the NXT. There are 8 lines of text avaiable to the users, and valid arguments for this parameter are 0-7, which correspond to lines 1-8 on thte NXT's screen. text - The text parameter is what shows up on the screen. This will be a string enclosed in quotes up to 16 characters. You may also display variables with this parameter by using the "%d" to display a variable definined in later parameters. You may use up to 3 "%d" characters to display 3 seperate variables. Remeber that you can only display 16 total characters, so the value of the variables will take up some of those 16 characters.

eraseDisplay();NXTClears the NXT's LCD screen of all text and GUI images. eraseDisplay(); Miscellaneous Miscellaneous useful commands that are not part of the standard C language. random(value);NXTReturns a random number (integer) between 0 and the 'value' of the function. int x; //declares x as an integer x = random(100); //Returns a random value between 0 and 100