- :-

Topics Covered

  • Task Main
  • Pragma Statements
  • Command and Parameters
  • Forward Command
  • Backward Command
  • Check Your Understanding:
    1. 1. What does the "#pragma" command mean in ROBOTC?
    2. A command that sets information about the motors and sensors being used
      A command that sets the type of robot being used
      A social media keyword to help users share their programs
      A command on which sample program to open
    3. 2. True / False: Semicolons are used to mark the end of a command or statement in ROBOTC?
    4. True
      False
    5. 3. What are the three parameters of the forward and backwards commands?
    6. Distance, Words, Numbers
      Quantity, Unit Type, Speed
      Units, Speed, Unit Type
      Wheel Size, Distance, Acceleration
    Try It!
    Try it! 1

    Changing Parameters

    Try changing the distance parameter value - does the robot travel further?

    Try changing the unit type parameter - does the robot travel shorter or further distances?



    What are the differences between degrees and rotations? Differences between degrees and seconds?

    Try it!
    Try it! 2

    Error Messages

    Try removing an semi-colon from a command line, then download the program to the robot.

    Try it!

    What Happens?
    The "Compiler Errors" window will display a warning about a missing semi-colon.

    However, the compiler will automatically insert the missing semi-colon when downloading to robot.
    Try it! 3

    Using the Function Library

    ROBOTC also comes with an extensive Functions Library, typically to the left of the code area. Try searching for commands, then dragging it into the code area.

    Try it!

    What Happens?
    Similar to ROBOTC Graphical, dragging commands from the Function Library will generate the command with pre-populated parameter, which can be replace with the desired values.
    Did You Know?

    Did you know?

    ROBOTC Graphical and Natural Language Mode

    If you have experience with ROBOTC graphical, you can convert your existing programs over to ROBOTC "Text-Based"

    Use the "View > Convert Graphical File to Text" command to create a copy of your program in the text-based version of ROBOTC.

    ROBOTC has multiple options and preferences available to customize your experience.

    For this curriculum, you will use ROBOTC Simple Behaviors using the Natural Language setting.

    Ensure the "Natural Language" mode is enabled, otherwise you may experience compiler errors.

    Did you know?

    Pseudocoding

    In robot programming we break robot actions into things that we call behaviors. An example of a robot behavior is “move forward”.

    When programmers begin to think about how to program their robot they need to break their robot's program into behaviors as they develop their code.

    Abstracting these complex behaviors can involve a lot of steps.

    If you write the behaviors down along the way in plain English, you will end up with pseudocode, an English-and-code hybrid.

    Pseudocoding is considered a good programming practice, because:

  • It helps you keep track of what you’re doing at each step

  • It helps to make large programs understandable

  • It expresses your thoughts in a way that other humans can understand, and sometimes help you with

  • It forces you to start organizing your thoughts in a way that gets you closer to being able to write working code

  • Basic Robot Movement - Mini Challenges

    Mini Challenge 1: Power vs. Distance

    The Power and Distance Investigation involves changing the values of the power parameter to then see if there is a direct relationship between power and how far the robot travelled. The timing of the program will remain constant throughout the investigation.
    • On a table, run the robot at different power levels multiple times, recording the distance travel, then calculating the average distance travelled.

    Mini Challenge PDF[ Power and Distance Investigation.pdf ]

    Mini Challenge 2: Wind Sprints - Level 1

    In the Wind Sprints Challenge, the robot is programmed to move forward 25 cm, then 25 cm backwards, then 50 cm forward, and 50 cm backwards - all the way up to 100 cm.

    The robot that completes the course the fastest wins, but the wheels on the robot cannot cross the distance lines completely. If it does, then the robot is disqualified.
    • On a table, choose a starting line, then create three lines from start at 25 cm, 50 cm, and 100 cm.

    Mini Challenge PDF[ Wind Sprints - Level 1.pdf ]