Working with sensors

30 Aug 2022 - 14:44 | Version 1 |

Objectives

  1. Learn about selection
  2. Be able to read sensors
  3. Be able to respond to the brick buttons
  4. Work with text
  5. Send data from one block to another
  6. Learn about timing

Assignment

  1. Attach the following sensors. They only need to be connected via a wire to the brick. Later you will be mounting senors.
    1. Touch sensor on port 1
    2. Ultrasonic sensor on port 2
    3. Color sensor on port 3
  2. Create a clean program to display each of the sensors as following:
    1. if the left button is pressed, display the status of the touch sensor
    2. if the middle button is pressed, display the value of the ultra sonic sensor
    3. if the right button is pressed, display the value of the color sensor
    4. if the top button is pressed, have the brick say something or make a sound
    5. make sure that the display can be easily read before the program ends
  3. Do not:
    1. use any repetition
    2. use any parallel programming
  4. Do not forget to:
    1. Include a comment block that indicates the names of the members of the team, which robot it as designed for, and the assignment
    2. Make the code look neat

Submission instructions

  1. Due date is found on Canvas
  2. Each person should create a pdf document that contains the following information
    1. Your name
    2. Your partner's name
    3. A brief description of what you did and a brief description of what your partner did. Include how that has varied from last time.
    4. How well you achieve each objective
    5. Which hints you used
  3. Submission:
    1. Team member A submits the team's code and his/her pdf document in one zip folder.
    2. Team member B submits his/her pdf document (does not need to be zip'ed)

Hints

These hints are on separate pages. Do not look at them unless you are lost. You will not be penalized for using them but you should try things on your own first. Most of the hints from the first lab also still apply!
  1. Getting data from a sensor to a string
  2. Displaying the string on the brick
  3. Trouble seeing the string on the brick

Challenges

  1. Include the rotational sensor (for the bottom button) and describe how to use it is your writeup
  2. After the individual sensor is displayed and read, display all sensors with only one more block for displaying.
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback
This website is using cookies. More info. That's Fine