Unit 5 – “Watch Out!”. Introduction New Topics Case Structures New Functions Less? Comparison...

Preview:

Citation preview

IntroductionNew Topics

Case StructuresNew Functions

Less? Comparison FunctionUltrasonic Sensor

Case StructuresCan be placed the same

way as a while loopSelector Label contains

the list of all casesDefault is true and false

Case Selector changes what case we are inCase selector must be

connectedCan write different code

in each case

Ultrasonic SensorAllows you to use the

ultrasonic sensor on the robot

Outputs the distance between the robot and an objectValue between 0 – 255

Must specify which port the sensor is connected on the NXT Brick

Less?Compares numeric

functionChecks to see if the top

value is less then the bottom value

Outputs a Boolean valueTrue if it is lessFalse if it is greater (or

equal to)

Recommended