Building and Programming Robots Challenges

Building and Programming Robots Challenges
Slide Note
Embed
Share

Building and programming robots in Tinkercad for Week 5 exercises. The extension challenge involves creating a complex locking system using sensors to enter an unlock code. Instructions are provided on setting lock values, generating unlock codes, activating LEDs, and responding to motion-triggered hacks. Various coding techniques and functions are suggested for creating the system effectively, with tips for testing using the Serial monitor.

  • Robotics
  • Programming
  • Tinkercad
  • Sensor Board
  • Coding

Uploaded on Feb 27, 2025 | 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. Valiant robots Week 5 exercises

  2. Building and Programming robots in TINKERCAD This is the last week for this topic before the challenge day. You should aim to have completed at least Bronze from previous weeks. The exercises provided here are intended as extension challenges using the sensor board circuit to practice text based programming. You should aim to have completed all the Silver challenges from previous weeks before starting these, and Gold challenge for the sensor board in week 4. You can continue working on the same sensor board circuit as last week, but may want to comment out the code in the loop() function.

  3. Extension Challenge: Aim: To create a complex locking system using sensors to enter the unlock code. Sensors will need to be set to different values in sequence to unlock the system. The system also needs to know if someone is trying to hack it, by checking for motion (PIR and Tilt sensor). If a hack is detected, the unlock code will be reset.

  4. Extension Challenge: Requirements: 1. The code contains 6 values and will be unlocked with the LDR, temperature sensor, moisture sensor, force sensor, ultrasonic sensor and the potentiometer in sequence. Lock values will be in the range 0-9 e.g. lock1 = 7, LDR values between 535-601 map to 7 2. The code to unlock the door is generated randomly at start() e.g. in start() lock1 = random(10); 3. When the sensor is set to the correct value, the next LED in the sequence turns on Note, the RGB LED counts as three LEDs 4. Once all 6 locks have been set correctly, the bulb comes on 5. If the tilt switch or PIR are triggered, the code for the lock resets Hint: You may want to define a function to reset the code and LEDs

  5. Extension Challenge: Remember: 1. To compare a number exactly matches use: if(num == target){...} 2. Map values between different ranges using: result = map(inputValue, inputMin, inputMax, outputMin, outputMax); 3. Creating a function to reset the lock can be started with: void resetLock(){...} Then called by using: resetLock(); 4. To ensure the locks can only be opened in sequence, they will need to be nested inside if-statements 5. Checking for motion from PIR or Tilt switch will need to be done outside of the unlock if-statement

  6. Extension Challenge: Remember: 6. To help with testing, it will probably be useful to print out some details to the Serial monitor. To do this, remember to first begin the Serial monitor in the start() function Serial.begin(9600); 7. Printing a message like Lock 1: 8 can be done as follows: Serial.print( Lock 1: ); Serial.println(lock1);

  7. Thank You

More Related Content