Follow and Contact Us! Logo and Images are subject to Copyright .
  • Home
  • Introduction
    • Mindstorms Environment
    • Know Your Blocks!>
      • Common Palette Blocks>
        • The Wait Blocks
      • Complete Palette Blocks>
        • Action Blocks
  • Sensors
    • Why Use Sensors?
    • Touch Sensor
    • Ultrasonic Sensor
    • Light Sensor
    • Color Sensor
  • Motors
    • Swing Turns
    • Point Turns
    • Motor-A
    • Curving Robot?!
  • Advanced Code
    • Advanced Code Help
  • Videos & Websites!
    • Lego Mindstorms Website
    • FLL Website
    • nxtprograms.com (Projects)
    • The NXT Step Blog
    • NXT Club Blog
    • CodeBase

Advanced Code

NXT Programming looks cute and easy for the most part. However, when you get into the more advanced section of Lego Mindstorms Programming, you witness a whole new world... Not ready for it yet? Visit Know Your Blocks or Advanced Code Help. Want further Advanced Code? Visit Code Base for complex Computer Science! We are working on a Java template download for NXT Programming!

Advanced Code Help

Advanced Program #1

In this program we will teach our robot to react to a touch sensor being pressed and released. We will be using the Complete Palette instead of the Common Palette.  Click on the images below to enlarge them!
(Step 1) Drag out a Wait Block from the flow bar, set the mode to time, and the duration to 5 seconds. This causes our robot to pause for five seconds before executing its desired function.

(Step 2) Drag out a Loop Block, this lets us execute the function over and over again until we want to end the program.

(Step 3) From the sensor bar, drag out a Touch Sensor Block and place it inside the loop. At the moment this block has no function!

(Step 4) From the action bar, drag out a Color Lamp Block and place it inside the loop. This has no function at the moment either! Now click on the circled area which is shown in the picture to activate the data hub! The picture shows what it looks like after you click on the Data Hub Tab.

(Step 5) Finally! Now we get to the most important part of this program the Data Wires! Hover your mouse over the Logic hub until the oil can appears, then click and attach the green wire to the action hub on the Color Lamp. Look at the picture!

(Step 6) Good Luck!
Picture
Step 1!
Picture
Step 2!
Picture
Step 3!
Picture
Step 4!
Picture
Step 5!
Powered by Create your own unique website with customizable templates.