Top Banner
Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber
38

Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Dec 28, 2015

Download

Documents

Lily Sherman
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Programming 101The Common Palette

Content provided by Connor Statham

(6th Grade Student)

Formatting by Shannon Sieber

Page 2: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

The Common Palette

Page 3: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

MOVE Block

•This block will make your robot move

Page 4: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

MOVE Block Function Editor

• Port: the places where your motors are hooked up

• Direction: what direction you want the motors to turn

Page 5: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

• Steering: Slows down one motor and speeds up another to make your robot turn.

• Duration: how long, # of rotations (of motor), # of degrees (of motor), seconds, etc.

• Next Action: Do you want a complete stop (BRAKE) or to coast to a stop?

Page 6: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

RECORD/PLAY Block

•You can move you’re your robot manually and this will record the actions your robot is taking in a program. You can later play it back.

•Pros: Can come in handy to help troubleshoot

•Cons: It is saved in a temporary file so when you turn off the robot, it is gone, and it takes up a lot of memory

Page 7: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

RECORD/PLAY Function Editor

• Action: Are you recording or playing the actions?

• Recording: Which ports are you recording?

• Time: How long are you going to record for?

Page 8: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

SOUND Block

• Use this if you would like for your robot to “say” something.

• You can use words already available or create your own files.

• This does take up quite a bit of your memory

• The sounds are not very loud

Page 9: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

SOUND Block Function Editor

Action: Sound File-choose from a ready made file or one you provide

Action: Tone-gives you a keyboard to program how long you want certain notes to be played for)

Page 10: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

DISPLAY Block

• This block allows you to display things on your NXT Brick

• It is useful when you want to see a how long a count or timer has been going in a program.

• It can also display pictures

Page 11: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

DISPLAY Block Function Editor

• Action: choose from an image, text, drawing or to reset the screen

• File: choose what you want displayed

• Position: where on the screen do you want the image, centered, to the left, etc.

Page 12: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

WAIT FOR…Blocks

• These blocks make the robot pause until either the time is up or a value is true

Time

Touch

Light

Sound

Distance(ultrasonic)

Page 13: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Choosing what you want to wait for…

Choose if you are waiting for

time or a sensor

Page 14: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Wait for TIME Function Editor

• Until: Decide how many seconds you want the robot to wait.

Page 15: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Wait for the TOUCH sensor Function Editor

• Port: decide where your sensor is hooked up to the NXT Brick

• Action: should the sensor be pressed in, released, or bumped to continue on to the next step

Page 16: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Wait for the value of LIGHT to change Function Editor

• Until: wait until the value of light is greater than or less than a number value you specify

• Function: you can have the sensor generate light if you need it to

Page 17: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Wait for SOUND Function Editor

• Until: the robot will wait until the sound level is higher or lower than your specified value

Page 18: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Wait for DISTANCE (ultrasonic) Function Editor

• Until: The distance is greater than or less than your designated distance. Distance can be measured in inches or centimeters

Page 19: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

LoopThe sequence of blocks inside of the loop will repeat over and over or until the value is true

Loop FOREVER

Loop until SENSOR is activated

Loop for a certain amount of TIME

Loop for a certain COUNT

Loop until a value is true (LOGIC)

Page 20: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Loop FOREVER

• Loops over and over and over again.

Page 21: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Loop TOUCH SENSOR

• Loops until a sensor is activated, in this case, TOUCH Sensor

Page 22: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Loop LIGHT SENSOR

• Loops until the value of light is changed

Page 23: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Loop ROTATION SENSOR

• Loops until the rotation sensor has rotated a certain number of degrees or a certain number of rotations.

• You can also reset the rotation sensor with this block

Page 24: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Loop SOUND SENSOR

• Loops until the sound sensor has detected a designated level of sound.

Page 25: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Loop TIMER

• Loops until a timer is greater than or less than a specific value.

• You can also reset the time with this block

Page 26: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Loop for a DISTANCE (ultrasonic)

• Loops until the robot has gone less than or greater than a specified distance.

Page 27: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Loop TIME

• Loop for a specified number of seconds

Page 28: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Loop COUNT

• Loops a certain number of times (e.g. if you put 4, it will repeat the program inside the loop 4 times)

Page 29: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Loop (Logic)

• Loops until a value is true.

• This requires wiring

Page 30: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Switch

• These are like “If…then…else” statements.

• IF this is true, do this, if ELSE, THEN do this.

Page 31: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Switch TOUCH Sensor• IF the touch sensor is pressed,

released or bumped (you select), THEN do what ever your commands are on the top.

• Else, do your commands on the bottom

Page 32: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Switch LIGHT Sensor• IF the value of light is less than or

greater (you decide) a value, THEN do what is the top of your switch

• ELSE do what is the bottom of your switch

Page 33: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Switch ULTRASONIC Sensor

• IF the distance is a certain value, THEN do what is in the top of your switch

• ELSE do what is in the bottom of the switch

Page 34: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Switch ROTATION Sensor

• IF the rotation sensor has gone a specified amount of degrees or rotations, THEN do the top commands,

• ELSE do the bottom commands

Page 35: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Switch TIMER

• IF the timer reads a certain number THEN do the commands in the top,

• ELSE, do the commands in the bottom

• You can also reset the timer

Page 36: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Switch SOUND Sensor

• IF the sound has reached a certain level or below that level, THEN, do the commands in the top

• ELSE, do the commands in the bottom

Page 37: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

Switch LOGIC

• IF a value is true/false, THEN do the commands in the top

• ELSE do the commands in the bottom

• Requires Wiring

Page 38: Programming 101 The Common Palette Content provided by Connor Statham (6 th Grade Student) Formatting by Shannon Sieber.

The END

• You have now completed Programming 101, The Common Palette

• This is a working document so please do not consider it the end all to basic programming with the NXT, but hopefully it will get you a good start.