Self-Driving Car Project Week 8 Exercises: Programming Robots in TinkerCad

self driving car project week 8 exercises n.w
1 / 9
Embed
Share

"Join an exciting self-driving car project in Week 8 as you program robots in TinkerCad. Enhance your text programming skills, work on line following sensors, and tackle challenges in bronze, silver, and gold levels. Get hands-on experience and advance your robotics knowledge!"

  • Robotics
  • Self-Driving Car
  • Programming
  • TinkerCad
  • Sensors

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Self-driving car project Week 8 Exercises

  2. Programming robots in TINKERCAD This week you be using TinkerCad Circuits to continue programming the self- driving car. This workshop aims to revisit the text programming done previously and continue to develop your text programming skills. If you didn t complete the circuit from Week 7, copy and tinker the Elegoo robot car from the classroom activities then complete Week 7 silver before starting these exercises. Please complete the bronze requirements before starting the silver, and complete the silver before starting the gold.

  3. Joining the Classroom Go to www.tinkercad.com/joinclass Enter class code: Y81PSFC2Y Enter your nickname as provided by us You should then continue with the Elegoo circuit from Week 7

  4. Line following sensors PIR sensors used as substitute line following sensors from TinkerCAD circuits

  5. BRONZE Challenge: Tasks: Notes: 1. Add #define statements for the line following sensor pins (see notes for details) Set pinModes for the line following sensors as Inputs Move code written last week from the loop function to new functions Add a function called `void lineFollow() then call this function from the loop. This new function will be developed in the next task Line sensor pins: left line pin: 2 mid line pin: 4 right line pin: 10 Functions should represent actions we may want to easily repeat. e.g. slowly accelerating might have a function: void drivePattern() { } void lookAround() { } void slowAccelerate(int targetSpeed){ } void obstacleAvoid(){ } 2. 3. 4.

  6. SILVER Challenge: Tasks: Notes: Defining boolean variables: bool variableName; 1. Add 3 boolean (bool) variables to the lineFollow function and initialise them with values from digitalRead for each of the line sensors. Print the values from the line sensors to the serial monitor (e.g. see notes) Add three if-else statements of the form if(left && !mid && !right) filling in appropriate behaviour for each Reading from the sensor: variableName = digitalRead(leftLinePin); 2. Printing values Serial.print("left: "); Serial.println(left); 3.

  7. GOLD Challenge: Aims: Consider what happens if two of the sensors are detecting the line? Add appropriate conditions and behaviours to match You may wish to consider the rate of turning. Do you need to add/modify driving functions elsewhere? Notes: You may want to use multiple if statements to create the logic of your program. E.g. if (centerDistance < 20) { Use the serial monitor to help solve problems by printing out what part of the code is running e.g. Serial.println( driving forward ); or Serial.println( found obstacle ); Remember to watch the video to guide you through this task.

  8. Extension Challenge: What else can you add to this program? Line sensors can be used for functionality other than following a line. Can you make your autonomous count how many lines it has crossed with all 3 sensors detecting the line, e.g. driving over a bar code. After driving over 3 lines, the robot should perform a behaviour.

  9. Thank You

Related


More Related Content