NXT Basics Technic Building and NXTG Erin Cejka
NXT Basics: Technic Building and NXT-G Erin Cejka Riecker Center for Engineering Educational Outreach Tufts University
Getting to Know the NXT
Motors and Sensors
Technic or “Studless” Building Pieces: n Studless beams n Connectors n Axles Features: n Symmetry n Sturdy
Build a Two Motor Car
NXT-G Interface Tutorials Toolbar Workspace Sequence Beam Palettes Controller Configuration Panel Help & Navigation Web Portal
NXT-G tools n n n Pointer tool: move blocks, select blocks Pan tool: move within workspace Comment tool: add notes to your code
Intro to NXT-G: Palettes Common: Complete: Custom: Most commonly used blocks All blocks Downloaded and created blocks
Writing a Basic Program n Drag and drop block(s) on sequence beam n Manipulate Configuration Panel & Download
Intro to NXT-G: Controller Download & Run Selection NXT Window Stop Download & Run
NXT Rotation Sensor n n n Built in to motors Measure degrees or rotations Reads + and Degrees: accuracy +/- 1 1 rotation = 360 degrees
Viewing Sensors n n n Connect sensor Turn on NXT Choose “View” Select sensor type Select port
NXT Sound Sensor n Sound sensor can measure in d. B and d. BA q q n d. B: in detecting standard [unadjusted] decibels, all sounds are measured with equal sensitivity. Thus, these sounds may include some that are too high or too low for the human ear to hear. d. BA: in detecting adjusted decibels, the sensitivity of the sensor is adapted to the sensitivity of the human ear. In other words, these are the sounds that your ears are able to hear. Sound Sensor readings on the NXT are displayed in percent [%]. The lower the percent the quieter the sound. http: //mindstorms. lego. com/Overview/Sound_Sensor. aspx
Challenge: Stop with sound n Program your NXT car to drive until you yell “Stop”
Example Program: Stop with Sound
NXT Ultrasonic/Distance Sensor n n Measures distance/proximity Range: 0 -255 cm Precision: +/- 3 cm Can report in centimeters or inches http: //mindstorms. lego. com/Overview/Ultrasonic_Sensor. aspx
Challenge: Parking NXT n n Program your NXT car to drive forward until you “find a parking spot” (hit a touch sensor) The car should then turn into the spot, and stop when it gets close enough to wall.
Example Program: Parking NXT
A note about NXT memory n n n Memory space is limited! To clear space, use NXT window Show and delete system files for more space
NXT Structure: Loops
Challenge: Stay on Table n Program your NXT to stay on the table
Example Program: Stay on Table
NXT Structure: Switch
Challenge: Remote Control n Program car to drive while the touch sensor is pushed and stop while the touch sensor is released
Example Program: Remote Control
NXT Sound n n NXT can play sound files or notes Sounds take up more memory space
NXT Display n n Display images, text, or drawings Choose location on display screen 100 x 64 pixels (up to 7 lines of text) Graphics take up memory space
Challenge: Say Hello n n n Have the RCX say hello using sound and the display screen Don’t forget – the program ends after the last block. You may need a wait for to see the display. Caution: one of the options in the configuration panel is Clear – use it to clear screen. Otherwise, uncheck the box!
Example Program: Say Hello
My Blocks n n n Create custom blocks Saved in custom palette Download blocks from the web
Creating My Blocks n Write the code for the My Block
Creating My Blocks n Select all the blocks to be used for My Block
Creating My Blocks n n Choose “Create My Block” on toolbar Or, go to the Edit menu and select “Make a new My Block”
Creating My Blocks n Name My Block n Add a description
Creating My Blocks n Create a custom icon
Creating My Blocks n My Block appears in Custom Palette
Challenge: Create My Block n n Come up with a program where you might use a My Block May use it to repeat actions or to conserve workspace
Example Program: Create My Block n n n This program displays “If you’re happy and you know it, press the touch sensor (and hold it)!” If the touch sensor if pressed, it displays a happy face, otherwise it displays a sad face A My Block is used for the text display
Example Program: Create My Block
Design Challenge: Alarm System n n Build an alarm system using the NXT Alarm can be triggered by any sensor (or use more than one) Alarm should have an audio component Alarm can use display or motors as well
- Slides: 40