Lecture4_more_progra - Learning More About Programming Variables Variables are places to store values(such as sensor readings for later use or for

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
9/27/2010 1 Ò Learning More About Programming Variables Ò Variables are places to store values (such as sensor readings) for later use, or for use in calculations. There are three main steps involved in using a variable: Ò Create (“declare”) the variable Ò Assign the variable a value Ò Use the variable to access the stored value Variables Ò The variable “speed” is used to store a number, and then retrieve and use that value when it is called for later on Ò It stores a number given by the programmer, and retrieves it twice in the two different places that it is used, once for each of the motor commands Ò This way both motors are set to the same value Ò You would only need to change one line of code to change both motor powers Ò The ability to store sensor values (measured by the robot, rather than set by the programmer) adds invaluable new capabilities Ò It gives the robot the ability to take measurements in one place and deliver them in another Ò Robot can do its own calculations using stored values
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/03/2010 for the course COP COP2510 taught by Professor Mlag. during the Fall '10 term at University of South Florida - Tampa.

Page1 / 5

Lecture4_more_progra - Learning More About Programming Variables Variables are places to store values(such as sensor readings for later use or for

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online