Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Enchanting Cards v1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Configuring a Sensor

(tell your NXT what is plugged into it, and where)


Suppose we have an NXT with a light sensor connected on port 3. How do we tell Enchanting this? 1. Click on the Sensing palette. 2. Click on the Congure Sensors button. A dialog comes up. 3. Find the light sensor conguration block on the left-hand side of the dialog. Drag it to Sensor Port 3 and drop it there. 4. Choose what sort of light sensor you have.

6. Press OK.

5. Optionally, give it a descriptive name. 0

7. You now have new blocks to use!


http://enchanting.robotclub.ab.ca

Morse Key
Press a button to make a sound.
Select the

Morse Key
palette, and click on the

!"#$%"&'(

button [it is above all the light blue blocks]. Congure a touch sensor, like this: Make sure that your touch sensor is on port 1 on the actual robot.

Name it.

#%($#)*+$,-'"

! p e Be
Click the and wait for the program to run on the robot. Press and release the touch sensor. What happens? What would happen if you changed the note or the duration? Where could you use or

'-$*#.

!-$/&%#)"%
?

(-0$1""' An NXT with a touch sensor connected to port 1.

http://enchanting.robotclub.ab.ca

Range Finder
See how far away something is.
From the

Range Finder
palette, choose the button. Congure a ultrasonic sensor. Make sure the port you congure it for matches the port the real ultrasonic sensor is plugged into!

!"#$%"&'(

#%($#)*+$,-'"

'-$*#.
Click the and wait for the program to run.

(-0$1""' An NXT with an ultrasonic sensor connected to port 4.

Point the ultrasonic sensor at different objects. What do you see on the screen?

http://enchanting.robotclub.ab.ca

What are the largest and smallest values you see? Are there any gaps where you get no numbers?

!-$/&%#)"%

Sound Meter
Create a sound-level meter.
From the the

Sound Meter
palette, choose button.

!"#$%"&'(

quiet

Congure a sound sensor. Paint a new costume for the sprite -- make it a dot!

#%($#)*+$,-'"

LOUD!
(-0$1""' An NXT with a sound sensor* connected to port 2.
* Not included in all NXT sets.

Click the and wait for the program to run.

'-$*#.

http://enchanting.robotclub.ab.ca

Whisper, talk, sing, shout, or blow on the sound sensor.

Draw a gauge on the background. Adjust how far the meter moves back and forth.

!-$/&%#)"%

Differential Drive
(lets your two-wheel robot drive around)
From the palette, choose the The robot needs to know which ports the left and right motors are on so it can steer! If your robot has two wheels, it is using a differential drive! button. Congure a differential drive. The rst number embossed on a LEGO tire is the tires diameter in millimeters. This tire is 56 mm across.

Le ft m oto
Po rt C
Po rt A

If you tell the robot to drive forwards and it goes backwards, swap the direction that youve congured the motors to drive in the drive type.

Ri gh tm oto r

9.4 cm

The track width is how far apart the wheels are. Measure from a place on the left wheel to that same place on the right wheel. Here, measuring from the left-most point of the left wheel to the left-most point of the right wheel, the track width is about 9.4 cm.

http://enchanting.robotclub.ab.ca

Square Dance
Drive in a square.

Square Dance
!"#$%"&'(
From the palette, choose the button. Congure a differential drive, using the instructions on Card #4. Measure numbers to match your robot.

#%($#)*+$,-'"

Click the and wait for the program to run. Unplug the USB cable and place the robot where you want it to start. Press the orange enter button on the NXT.

'-$*#.

Does the robot dance in a square? (Is it congured properly?) Note that youll never get 100% accurate motion.

(-0$1""' An NXT with two driving wheels.

Press the orange enter and dark grey exit buttons on the NXT to quit the program before plugging it back into the computer.

http://enchanting.robotclub.ab.ca

!-$/&%#)"% What other shapes and patterns could you make the robot dance? Could you have one robot dance a square inside a square being danced by another robot, at different speeds?

Crash Test
Drive into a wall and then stop.
!

Crash Test
as on Card #4.

!"#$%"&'(

! . Congure a touch sensor for use as a bumper.

#%($#)*+$,-'"

Click the and wait for the program to run. Unplug the USB cable and place the robot where you want it to start. Press the orange enter button on the NXT.

'-$*#.

(-0$1""' An NXT with two driving wheels and a bumper (touch sensor) on port 1.

The robot drives until it hits something. Pick it up and press the enter button again. It drives until it hits something.

http://enchanting.robotclub.ab.ca

!-$/&%#)"% Can you make the robot say something when it hits a wall, such as, Ouch, my nose or Ooof? Could you draw eyes on it and make it wince? How would you make the robot explore a room? Try it out!

Mexican Wave
Shout go, and each robot, in turn, drives forwards, backwards and forwards again.
!

Mexican Wave
as on Card #4.

!"#$%"&'(

! . Congure a sound sensor to listen for the start command.

#%($#)*+$,-'"

This works best if you have a whole line up of robots. The delay for each robot is a couple of seconds longer for the one before it in line. On each robot, click the and wait for the program to run. Unplug the USB cable and place the robot in line. Then, on a signal, you all shout go together, and then, one by one, the robots do the same wave maneuver!

'-$*#.

(-0$1""' 1+ NXTs, each with two driving wheels and a sound sensor* on port 2.
* Not included with all NXT sets.

What other displays can you choreograph?

!-$/&%#)"%

http://enchanting.robotclub.ab.ca

(Choreography is the art of designing of movements, and comes from Greek words meaning dance writing).

Shy Puppy
Robot follows you around and wants to be close, but not too close!
!

Shy Puppy
as on Card #4.

!"#$%"&'(

! . Congure an ultrasonic sensor.

Too far!
#%($#)*+$,-'"

Too close!

Click the and wait for the program to run. Unplug the USB cable and press the orange enter button on the NXT.

'-$*#.

Just right!

Try walking away from the robot. Does it follow? Try going towards it. Does it shy away? Does it ever stand still? What would happen if you made the robot turn?

!-$/&%#)"%

(-0$1""' An NXT with two driving wheels and an ultrasonic sensor pointing forwards

What do two or more robots together do? Add a face to the robot, make it speak, or dress it up!

http://enchanting.robotclub.ab.ca

Sparkline
Graph a changing value.

Sparkline
In , choose the button. Congure a light or colour sensor, choosing the one you have.

!"#$%"&'(

#%($#)*+$,-'"

(-0$1""' An NXT with a light or colour sensor on port 3.

http://enchanting.robotclub.ab.ca

Click the to start. Move the light sensor over different colours and shades. Move it closer and farther from a surface. Point it at a light. Change the angle. What happens?

'-$*#.

What happens if you add in the autocalibration blocks? Try drawing a white line on a black background. Change the lamp colour.

!-$/&%#)"%

Follow That Line!


Follow a line around.
! !

Follow That Line!


as on Card #4. . Congure and name a light or colour sensor, choosing the type that matches your sensor. Click the and wait for the program to run. Unplug the USB cable, place the robot on or beside a line, and press the orange enter button on the NXT. Press the dark grey exit button to stop the robot. What happens if you adjust the numbers? Does the line-following course make a difference? Can you follow the edge of a table? Where is the best place to put your light sensor? What would you do with a second or third sensor? Draw eyes and make them look left and right!

!"#$%"&'(

#%($#)*+$,-'"

'-$*#.

!-$/&%#)"%

(-0$1""' An NXT with two driving wheels and a light/colour sensor pointing downwards.

10

http://enchanting.robotclub.ab.ca

Locator
Find a nearby object.
!

Locator
as on Card #4.

!"#$%"&'(

! . Congure an ultrasonic sensor.

#%($#)*+$,-'"

Click the and wait for the program to run. Unplug the USB cable and press the orange enter button on the NXT.

'-$*#.

Move an object around in front of the robot. Does it turn to follow it?

!-$/&%#)"% How does it work? How would you do this with two sensors? (-0$1""' An NXT with two driving wheels and an ultrasonic sensor on port 4.
Can you make the robot ignore a wall (and anything else as far away as it)? Try making it scan in a full circle and point at the closest item.

11

http://enchanting.robotclub.ab.ca

Sumo
(card 1 of 2)
Push your opponent out of a ring. Trigger Sees edge Arbiter Foe ahead

Sumo
#)"$23&1 Behaviour Retreat Attack Wander
If it has nothing better to do, the robot wanders around. If it sees a foe ahead of it, the robot attacks, trying to push the enemy out of the ring. Most importantly, if it sees the edge, the robot retreats from it, in an effort to stay in the ring.

! Card #5.

as on

!"#$%"&'(

! . Congure an ultrasonic sensor and a light/colour sensor. Create a bunch of costumes for your sprite, using the text tool to display the following words in large letters, Countdown, Wander, Attack, Retreat and Press Button to Start. ! . Create variables named next action, foe ahead, and sees edge.

(-0$1""' Each competitor needs an NXT with two driving wheels, an ultrasonic sensor, and a light or colour sensor.

12A

http://enchanting.robotclub.ab.ca

Sumo
(card 2 of 2)
! Wander, and Startup. . Youll make blocks called Attack, Retreat,

#%($#)*+$,-'"

Click the and wait for the program to run. Unplug the USB cable and place the robot on the sumo board. When you are told to start your robot, press the orange enter button on the NXT.

'-$*#.

!-$/&%#)"%
Can you add other behaviours to the robot, or change some of the existing ones? What could you do to make your sumo robot better?

'-$*#.

Would this method of programming work for other robots?

12B

http://enchanting.robotclub.ab.ca

You might also like