5

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

Embed Size (px)

Citation preview

Page 1: Unit 5 – “Watch Out!”. Introduction New Topics Case Structures New Functions Less? Comparison Function Ultrasonic Sensor
Page 2: Unit 5 – “Watch Out!”. Introduction New Topics Case Structures New Functions Less? Comparison Function Ultrasonic Sensor

IntroductionNew Topics

Case StructuresNew Functions

Less? Comparison FunctionUltrasonic Sensor

Page 3: Unit 5 – “Watch Out!”. Introduction New Topics Case Structures New Functions Less? Comparison Function Ultrasonic 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

Page 4: Unit 5 – “Watch Out!”. Introduction New Topics Case Structures New Functions Less? Comparison Function Ultrasonic Sensor

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

Page 5: Unit 5 – “Watch Out!”. Introduction New Topics Case Structures New Functions Less? Comparison Function Ultrasonic Sensor

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)