Presentation is loading. Please wait.

Presentation is loading. Please wait.

An Introduction to VEX IQ Programming with Modkit

Similar presentations


Presentation on theme: "An Introduction to VEX IQ Programming with Modkit"— Presentation transcript:

1 An Introduction to VEX IQ Programming with Modkit
Robotics Lesson Materials: VEX IQ sensor car (per 2 students) Computer running Modkit (per 2 students) An Introduction to VEX IQ Programming with Modkit Lesson 03

2 Sensing: our 5 senses Humans make decisions based on environment and circumstances. We use our senses to gather ‘data’ which our brain can use to make a decision. List and explain human senses.

3 Sensors Just like humans, robots need to gather data about the world around them. They use ‘sensors’ to gather this data. This slide shows the different sensors in the VEX IQ kit. Note how these do not correspond directly to our senses. A brief explanation of each sensor should be given, but this lesson focuses on the ‘distance sensor’.

4 The distance sensor Let’s expand on the distance sensor. The name of the sensor already explains what it does, but how does it work? Have the students examine the sensor, The VEX IQ distance sensor is a simple sonar. As is often the case, when trying to solve a problem engineers look at nature to see how the problem was best solved there. Briefly explain how sonar works and ask the students if they know any animal that uses the same principle. Have a look at the distance sensor and related blocks in Modkit. The blocks are quite self-explanatory, but note how we have to set a maximum distance for this block.

5 Programming task: Try not to crash
Challenge You need to program the robot to…. Make our car drive forward Make sure the car stops when it is 20cm away from the wall There are different ways to program this task. Ask the students to formulate the ‘algorithm’ in their own words, ask them to use the ‘conditional statement’ ‘if’ in their recipe. Something like : ‘Go forward. If the distance to the wall is 20cm, stop’. Explain how getting an exact measurement of 20cm can be a problem: maybe we start our program closer to the wall, so it would still crash. Guide students to rephrase the algorithm using ‘greater than’ or ‘smaller than’ operators.

6 Programming task: Try not to crash
Ask the students to check their sensor cars to see where the distance sensor is located. The students will start Modkit and assemble their car in the robot view.

7 Programming task: Try not to crash
Start programing as usual from within the ‘Brain’ section. Explain how and when we need to set the ‘maximum range’ for our distance sensor.

8 Programming task: Try not to crash
We now need to program the ‘drive and stop before hitting the wall’-algorithm. Guide students to the ‘Control’ and ‘Operators’ blocks in Modkit, demonstrate how they snap into each other (look at the shapes) and how we can put values in the boxes.

9 Programming task: Try not to crash
Try to get the students to build the needed algorithm in the ‘drivetrain’ section of our program. Show them where they can find the ‘distance in mm’ block. The finished program is in the next slide (containing an error).

10 Programming task: Try not to crash
This program contains an error (distance sensor is only checked once). If the students think it is fine, let them try out the program. Once it crashes try to make them find out why: be a human robot and follow their instructions to the letter. When crashing into the wall, ask them how often they think you are checking your distance. Have the students correct the program by adding the needed loop. ->debugging

11 Programming task: Try not to crash
Adding the ‘forever’ loop solves the problem.

12 Programming task: While-statement
Ask the students to adjust their program by using the ‘While’ statement instead of ‘If’. (Program on next slide)

13 Programming task: While-statement
Explain how these are different solutions to the same problem. -> Programming is not about finding the 1 solution to a problem, but finding a (good) solution to the problem. Often problems will have many ‘correct’ answers – some can be more suitable than others – but all work.

14 Programming task: Automatic Car
Challenge You need to program the robot to…. Make our car drive forward When the car is 20cm or less away from a wall it needs to: Reverse for 10cm Turn 90 degrees Continue to drive forward This program needs to keep running until the user stops the program Programming task: The students will use the last example code combined with the knowledge from the previous lessons to try and create the program in the brief. The skills and blocks needed have been thought in this and previous lessons. (solution on next slide) Extension: using the Touch LED on the car: make it glow green when driving forward, red when turning and white and reversing. Make sure several students get to test their program. Even programs with mistakes can be good to demonstrate so students can try to debug their creations.

15 Programming task: Automatic Car
Extended program with lights on next slide.

16 Programming task: Automatic Car

17 Summary Today you have: Learned how robots can gather data.
Learning objective: Learn how robots gather data from their environment. Learn to program a VEX IQ robot with drivetrain and distance sensor. Learn about conditional statements and repeat structures . Today you have: Learned how robots can gather data. Learned to add the distance sensor to you robot. Programmed a robot to work autonomously. Learned how to use conditional statements. Programmed a fully automatic car.


Download ppt "An Introduction to VEX IQ Programming with Modkit"

Similar presentations


Ads by Google