You are previewing The Art of LEGO MINDSTORMS EV3 Programming (Full Color).
O'Reilly logo
The Art of LEGO MINDSTORMS EV3 Programming (Full Color)

Book Description

The Art of LEGO MINDSTORMS EV3 Programming is a beginner-friendly, in-depth guide to the EV3 programming language.

Table of Contents

  1. Dedication
  2. about the author
  3. about the technical reviewers
  4. acknowledgments
  5. introduction
    1. who this book is for
    2. prerequisites
    3. what to expect from this book
    4. how best to use this book
  6. 1. LEGO and robots: a great combination
    1. LEGO MINDSTORMS EV3
    2. the LEGO MINDSTORMS EV3 set
    3. the LEGO MINDSTORMS EV3 software
    4. software, firmware, and hardware
    5. art and engineering
    6. qualities of a good program
    7. what you’ll learn from this book
    8. the LEGO MINDSTORMS online community
    9. what’s next?
  7. 2. the EV3 programming environment
    1. a tour through the MINDSTORMS software
      1. A: the programming canvas
      2. B: the content editor
      3. C: the programming palettes
      4. D: the hardware page
      5. E: the download and run buttons
    2. writing an EV3 program
    3. general layout of a block
    4. your first program
      1. saving your work
    5. running your program
    6. project properties
    7. your second program
    8. comments
      1. adding a comment
      2. tips for working with comments
    9. context help
    10. conclusion
  8. 3. TriBot: the test robot
    1. TriBot components
    2. building the motor and wheel assembly
    3. building the caster wheel assembly
      1. assembling the caster wheel with the home edition
      2. assembling the caster wheel with the education edition
    4. adding the EV3 brick
    5. mounting the infrared or ultrasonic sensor
    6. connecting the color sensor
    7. attaching the gyro sensor (education edition)
    8. building a touch sensor bumper
    9. attaching the cables
      1. attaching the touch sensor
      2. attaching the infrared or ultrasonic sensor
      3. attaching the color sensor
      4. attaching the gyro sensor (education edition)
      5. attaching the motors
    10. alternate placement for the color sensor
    11. alternate placement for the ultrasonic or infrared sensor
    12. building a lift arm
    13. conclusion
  9. 4. motion
    1. the EV3 motors
    2. the move steering block
      1. mode
      2. steering
      3. power
      4. duration
      5. brake at end
      6. port
    3. port view
    4. the EV3 intelligent brick view menu
    5. the ThereAndBack program
      1. moving forward
      2. turning around
      3. testing a single block
      4. moving back to the start
    6. the AroundTheBlock program
      1. the first side and corner
      2. the other three sides and corners
      3. testing the program
    7. the move tank block
    8. the large motor and medium motor blocks
    9. the lift arm
    10. the invert motor block
    11. a problem with coasting
    12. further exploration
    13. conclusion
  10. 5. sensors
    1. using the sensors
    2. the touch sensor
    3. the BumperBot program
      1. moving forward
      2. detecting an obstacle
      3. backing up and turning around
      4. testing
    4. the color sensor
      1. color mode
      2. reflected light intensity mode
      3. ambient light intensity mode
      4. port view
    5. the IsItBlue program
      1. the switch block
      2. improving the program
        1. using the touch sensor
        2. adding a loop
    6. the LineFinder program
      1. using port view to find a threshold value
    7. the infrared sensor and remote
      1. proximity mode
      2. beacon heading and beacon proximity mode
      3. remote mode
    8. the BumperBot- WithButtons program
    9. the ultrasonic sensor
      1. distance inches and distance centimeters modes
      2. presence/listen mode
    10. the DoorChime program
      1. detecting a person
      2. playing a chime
      3. stopping the chime
    11. the gyro sensor
      1. rate mode
      2. angle mode
      3. resetting the angle
    12. the GyroTurn program
    13. the motor rotation sensor
      1. the BumperBot2 program
    14. further exploration
    15. conclusion
  11. 6. program flow
    1. the switch block
      1. setting the condition
    2. the LineFollower program
      1. the basic program
      2. selecting the color sensor threshold
      3. configuring the move blocks
      4. testing the program
      5. more than two choices
      6. testing the program
      7. using tabbed view
    3. the RedOrBlue program
      1. identifying red objects
      2. adding a new case
      3. the default case
    4. the loop block
    5. the loop interrupt block
      1. the BumperBot3 program
    6. further exploration
    7. conclusion
  12. 7. the WallFollower program: navigating a maze
    1. pseudocode
    2. solving a maze
    3. program requirements
    4. assumptions
    5. initial design
    6. following a straight wall
      1. writing the code
      2. testing
    7. turning a corner
      1. writing the code
      2. testing
    8. going through an opening
      1. writing the code
      2. testing
    9. final test
    10. further exploration
    11. conclusion
  13. 8. data wires
    1. what is a data wire?
    2. the GentleStop program
      1. writing the program
    3. tips for using data wires
    4. the SoundMachine program
      1. controlling the volume
      2. using the math block
      3. adding tone control
    5. understanding data types
    6. displaying the frequency and volume values
      1. using the text block
      2. adding labels to the displayed values
      3. displaying the volume
    7. further exploration
    8. conclusion
  14. 9. data wires and the switch block
    1. the switch block’s value modes
    2. rewriting the GentleStop program
    3. passing data into a switch block
    4. advantages of using a sensor block
    5. passing data out of a switch block
    6. simplifying the LineFollower program
    7. further exploration
    8. conclusion
  15. 10. data wires and the loop block
    1. logic mode
    2. the loop index
      1. the LoopIndexTest program
      2. restarting a loop
      3. the final loop index value
    3. the Spiral- LineFinder program
      1. following a spiral
      2. detecting a line while moving in a spiral
    4. using the gyro sensor for better turns
    5. further exploration
    6. conclusion
  16. 11. variables
    1. the variable block
    2. the RedOr-BlueCount program
      1. creating and initializing the variables
      2. displaying the initial values
      3. counting the red objects
      4. counting the blue objects
    3. managing variables using the project properties page
    4. the compare block
    5. the LightPointer program
      1. defining the variables
      2. finding the light source
      3. creating the Lightpointer program
    6. the constant block
    7. further exploration
    8. conclusion
  17. 12. my blocks
    1. creating a my block
    2. the my blocks palette
    3. editing a my block
    4. the LogicToText my block
      1. adding, removing, and moving parameters
      2. the parameter setup tab
    5. the DisplayNumber my block
    6. changing my block parameters
    7. variables and my blocks
    8. further exploration
    9. conclusion
  18. 13. math and logic
    1. the math block’s advanced mode
      1. supported operators and functions
      2. the modulo operator
      3. math block errors
    2. a proportional LineFollower
    3. EV3 timers
    4. the DisplayTimer program
      1. splitting the timer reading into minutes and seconds
      2. building the text to display
    5. the round block
    6. the random block
    7. adding a random turn to BumperBot
    8. the logic block
    9. adding some logic to BumperBot
    10. the range block
    11. the TagAlong program
    12. the GyroPointer program
    13. further exploration
    14. conclusion
  19. 14. the EV3 lights, buttons, and display
    1. the EV3 buttons
    2. the powerSetting program
      1. the initial value and the loop
      2. displaying the current value
      3. adjusting the power value
      4. testing the program
      5. changing the value faster
    3. the brick status light
    4. the ColorCopy program
    5. the display block
      1. displaying an image
    6. the Eyes program
    7. drawing on the EV3 screen
    8. the EV3Sketch program
    9. further exploration
    10. conclusion
  20. 15. arrays
    1. overview and terminology
    2. creating an array
    3. The Array Operations block
      1. length mode
      2. read at index mode
      3. write at index mode
      4. append mode
    4. the ArrayTest program
    5. the Button-Command program
      1. creating the array of commands
      2. displaying the commands
      3. executing the commands
    6. the Colorcount program
      1. the ColorToText my block
      2. the AddColorcount my block
      3. using a data wire to select a sound file
      4. initialization
      5. counting colors
    7. the MemoryGame program
      1. the start of the loop
      2. creating the sequence of lights
      3. the WaitForButtons my block
      4. checking the user’s response
    8. further exploration
    9. conclusion
  21. 16. files
    1. the file access block
      1. setting the filename
      2. writing to a file
      3. reading from a file
    2. saving the MemoryGame high score
    3. the FileReader program
    4. adding a menu to the ColorCount program
      1. the CreateMenu_CC my block
      2. the SelectOption my block
        1. selecting a menu option
        2. returning the selected option
        3. creating the my block
      3. the new ColorCount program structure
      4. counting objects
      5. saving and loading the count data
      6. testing
    5. managing memory
    6. further exploration
    7. conclusion
  22. 17. data logging
    1. data collection and the EV3
    2. investigating the current power reading
      1. the CurrentpowerTest program
      2. the LogData my block
      3. the CurrentpowerTest2 program
      4. testing the current power with the move steering block
    3. the SteeringTest program
    4. the VerifyLightpointer program
    5. controlling the amount of data
    6. further exploration
    7. conclusion
  23. 18. multitasking
    1. more than one start block
    2. the stop program block
    3. avoiding a busy loop
    4. adding lights to the DoorChime program
    5. understanding program flow rules
      1. starting blocks and data wires
      2. using values from a loop or switch block
      3. using my blocks
    6. synchronizing two sequences
    7. keeping out of trouble
    8. further exploration
    9. conclusion
  24. 19. a PID-controlled LineFollower program
    1. the PID controller
    2. proportional control
      1. the raw data
      2. the good and bad zones
        1. the good zone
        2. the light side bad zone
        3. the dark side bad zone
        4. the catastrophe zone
      3. selecting the target
    3. collecting the min and max sensor readings
    4. normalizing the sensor reading and target values
    5. enhancing the proportional control LineFollower
    6. implementing PID control
      1. adding the derivative term
      2. adding the integral term
      3. tuning the controller
    7. further exploration
    8. conclusion
  25. A. NXT and EV3 compatibility
    1. motors
    2. sensors
    3. software
  26. B. EV3 websites
  27. C.  
  28. Index
  29. Copyright