Presentation is loading. Please wait.

Presentation is loading. Please wait.

Casne.ncl.ac.uk www.ncl.ac.uk/computing/ Taking care of the CrumbleBot Please do NOT stress the robot's motors 1.Do NOT push the robot 2.Do NOT hold the.

Similar presentations


Presentation on theme: "Casne.ncl.ac.uk www.ncl.ac.uk/computing/ Taking care of the CrumbleBot Please do NOT stress the robot's motors 1.Do NOT push the robot 2.Do NOT hold the."— Presentation transcript:

1 casne.ncl.ac.uk www.ncl.ac.uk/computing/ Taking care of the CrumbleBot Please do NOT stress the robot's motors 1.Do NOT push the robot 2.Do NOT hold the robot down when the motors are running 3.Lift the robot off the floor/desk to switch it off Make sure the robot is switched off before you connect it to the computer Only switch the robot on after disconnecting it from the computer Be careful connecting and disconnecting the Crumble controller – hold the controller or the robot NOT the battery pack Use speeds around 50%. Only use higher speeds if your robot does not move (or where there's space!). 1

2 casne.ncl.ac.uk www.ncl.ac.uk/computing/ Important notes Make sure the robot is switched off before you connect it to the computer Only switch the robot on after disconnecting it from the computer Be careful connecting and disconnecting the Crumble controller – hold the controller or the robot not the battery pack Use speeds around 50%. Only use higher speeds if your robot does not move (or where there's space!). Make CrumbleBot move forward and backward To move forward set motor 1 and motor 2 to FORWARD at the same speed for the same amount of time. 1.This program makes the CrumbleBot move forward at speed 50% for 1 second then stop – The delay at the start is to give time to position the robot after switching it on – Sometimes left and right motors are not exactly the same power. You may have to adjust speeds to move straight forward. 2.Now program the robot to move backward (REVERSE) 3.Program it to move FORWARD then STOP and then REVERSE back to where it started 2

3 casne.ncl.ac.uk www.ncl.ac.uk/computing/ Important notes Make sure the robot is switched off before you connect it to the computer Only switch the robot on after disconnecting it from the computer Be careful connecting and disconnecting the Crumble controller – hold the controller or the robot not the battery pack Use speeds around 50%. Only use higher speeds if your robot does not move (or where there's space!). Make CrumbleBot turn right and left To program the robot to turn right slowly, just power the left motor FORWARD and STOP the right motor – The left motor is motor 1 1.This program makes the robot turn right at speed 50% for 1 second and then stop 2.You can make faster right turns (and spins) by powering the left motor FORWARD and the right motor REVERSE – Try it! 3.Now try: – Turning left instead of right – Reverse turns – turning at the same time as moving backward 3

4 casne.ncl.ac.uk www.ncl.ac.uk/computing/ Important notes Make sure the robot is switched off before you connect it to the computer Only switch the robot on after disconnecting it from the computer Shine the CrumbleBot lights There are two LEDs (called sparkles) at the front of the CrumbleBot – LED1 on the left and LED2 on the right Make sure the D output of the controller is connected to the LEDs connector on the CrumbleBot Now you can light an LED 1.This program makes LED1 (sparkle 0) shine red for 1 second and then turns it off 2.Add blocks to the program to make LED1 switch on and off like an indicator – Use the do 10 times loop from the Control tab and change the number of times your code repeats – Use another wait after turning the sparkle off 3.Program LED2 (sparkle 1) in the same way 4

5 casne.ncl.ac.uk www.ncl.ac.uk/computing/ Important notes Make sure the robot is switched off before you connect it to the computer Only switch the robot on after disconnecting it from the computer Be careful connecting and disconnecting the Crumble controller – hold the controller or the robot not the battery pack Use speeds around 50%. Only use higher speeds if your robot does not move (or where there's space!). CrumbleBot Challenges 1.Program the CrumbleBot to make the following moves 2.Try some of your own Move forward then turn right to return in the direction it came from Do a full circuitTry a figure of 8 Move forward Stop Indicate left (flash left LED) Turn left Move forward Stop and indicate left here 5

6 casne.ncl.ac.uk www.ncl.ac.uk/computing/ The CrumbleBot has 2 line sensors at the front of the robot to detect a black line beneath the robot – A red LED indicates that a line has been detected by the left line sensor – A green LED indicates that a line has been detected by the right line sensor – If both indicator LEDs are on then the both sensors are above a line A digital line sensor outputs one of two values – HI means line detected – LO means no line is detected (or there is a reflecting surface) Make sure the left sensor is connected to input B and the right sensor is connected to input C Right sensor is connected to input C Now you can write programs that check the values of inputs B and C Using CrumbleBot line sensors 6 input B left line sensor input C right line sensor

7 casne.ncl.ac.uk www.ncl.ac.uk/computing/ Remember: – Input B is HI when a line is detected on the left – Input C is HI when a line is detected on the right The following tabs have some useful blocks for these tasks Program the robot to: 1.Move forward until a line is detected on the left 2.Move forward until a line is detected on the right 3.Move forward until a line is detected on the left OR the right 4.Move forward until a line is detected on the left AND the right (both sensors are over the line) 5.Move forward then turn right if a line is detected on the left 6.Repeat forever: move forward until a line is detected then move backward until the robot is off the line Experiment with your own ideas for what the robot should do when it detects a line. You can even use to randomize the robots behaviour. Line sensor programs 7

8 casne.ncl.ac.uk www.ncl.ac.uk/computing/ Follow that line With input B connected to the left line sensor and input C connected to the right line sensor, a simple line following algorithm is: Forever: If B is HI: turn left If C is HI: turn right Otherwise: move forward 1.Write a program to make the CrumbleBot follow the algorithm and follow a line – Remember, it is a good idea to have a delay at the start of the program so that you have time to switch the robot on – Line following can be used for a robot to find its way through a building 2.Can you write a line avoidance program? – Line avoidance can be used to keep a robot inside a room or "fenced" off area Remember the robot will turn if one motor moves forward while the other motor is either stopped or reverses. Changing the speed of FORWARD and/or REVERSE changes the speed and sharpness of a turn Remember the robot will turn if one motor moves forward while the other motor is either stopped or reverses. Changing the speed of FORWARD and/or REVERSE changes the speed and sharpness of a turn 8

9 casne.ncl.ac.uk www.ncl.ac.uk/computing/ The CrumbleBot has analogue left and right light sensors – they output a range a values from 0 to 255 (instead of binary HI or LO) – 0 is dark, 255 is very bright You can connect the sensors to inputs (e.g. B and C) and make your robot react to different light conditions, for example: to seek out dark or light areas or to follow a torch To start, write a program that turns towards the light (e.g. a torch or a brighter part of the room). With B connected to the left light sensor and C connected to the right light sensor: – Turn right (towards brighter side) when – Turn left when – The value 10 is called a threshold value. You may have to change the threshold value for your robot to detect differences in light conditions on the left or right. – Note: you can set variables to the analogue input values to see the light sensor values when the CrumbleBot is connected to the computer Follow the light! 9


Download ppt "Casne.ncl.ac.uk www.ncl.ac.uk/computing/ Taking care of the CrumbleBot Please do NOT stress the robot's motors 1.Do NOT push the robot 2.Do NOT hold the."

Similar presentations


Ads by Google