• A sensor tells a robot one simple thing about it’s
environment – Temperature – Distance – Light intensity • Allow robots to see and feel the physical world through which they travel • Two main types of sensors: digital and analog
• The robot will interpret feedback from the sensor as a number from 0 to a pre-defined maximum (1024 for most Vex sensors) • A light sensor has many states: – If it is very bright, the sensor will return a number close to 30 – If it is very dark, the sensor will return a number close to 1000
• You can retrieve the value in this “container” when it is needed » There are different types of values you can store in variables. » You will use the “int” type, which allows you to store any whole number from 0 to a large number (positive or negative) » You can assign a starting value to your variable which will store that value at the start of the program
• While Loop – block of code that repeats itself as
long as the condition inside the parenthesis is true – The == operator returns true if both sides are equal, and false if they are not equal – In our code loop will always equal 1, so this loop will run forever