Working with sensors

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 left 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. Create one zip folder for the team
    1. place your code (making sure it has a comment that includes the lab assignment and the name of all team members)
    2. place each member's pdf in the folder
  4. Have one team member submit it in canvas.

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 topic: CenterForComputing > CSC102SylS2022 > CSC102F2022Lab2
Topic revision: r1 - 2022-07-07 - cathybareiss
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback