Edison Robot Drive Commands
This 1-page packet explains how to use the Ed.DriveLeftMotor and Ed.LeftLed commands to control an Edison robot. It's designed for 9th graders learning basic robotics programming and includes explanations of parameters, compatibility notes, and code examples.
“Create notes slides for the following information: Ed.DriveLeftMotor(direction,speed,distance) and Ed.DriveRightMotor(direction, speed, distance) Edison compatibility: V1V2V3 Parameters: Direction: Ed.FORWARD - Edison's left motor drives forwards. Ed.BACKWARD - Edison's left motor drives backwards. Ed.STOP - Stops Edison's left motor immediately. Speed: A positive integer number between 1-10. Ed.SPEED_1 - PWM controlled speed 1. Ed.SPEED_2 - PWM controlled speed 2. Ed.SPEED_3 - PWM controlled speed 3. Ed.SPEED_4 - PWM controlled speed 4. Ed.SPEED_5 - PWM controlled speed 5. Ed.SPEED_6 - PWM controlled speed 6. Ed.SPEED_7 - PWM controlled speed 7. Ed.SPEED_8 - PWM controlled speed 8. Ed.SPEED_9 - PWM controlled speed 9. Ed.SPEED_10 - PWM controlled speed 10. Ed.SPEED_FULL - Full power to the motors. (Please note- Edison may not drive perfectly straight with this setting.) Distance: An integer number for distance. The maximum value is 32767. OR Ed.DISTANCE_UNLIMITED - turns on Edison's motors and moves on with the code. (Note: a stop will be needed later in the code.) If using an integer number, note that the unit value of this number is set by Ed.DistanceUnits in the setup code. You can change the unit value by changing what Ed.DistanceUnits is set to in the setup code. Ed.DistanceUnits = Ed.CM - distance in centimetres (default for V2.0 and V3.0). Ed.DistanceUnits = Ed.INCH - distance in inches. Ed.DistanceUnits = Ed.TIME - distance in milliseconds (default for V1). Returns: N/A Explanation: Controls Edison's left motor to create movement. This can be set to move for a set distance (CM or INCH) or time period (TIME) and will drive the full distance before moving onto the next line of code. Examples: Drive Edison's left motor forward for 3 cm at speed 5. (Edison V2.0 and V3.0 only) Ed.DistanceUnits = Ed.CM Ed.Tempo = Ed.TEMPO_MEDIUM #--------Your code below----------- Ed.DriveLeftMotor(Ed.FORWARD, Ed.SPEED_5, 3) Drive Edison's left motor forward for 5 inches at speed 5. (Edison V2.0 and V3.0 only) Ed.DistanceUnits = Ed.INCH Ed.Tempo = Ed.TEMPO_MEDIUM #--------Your code below----------- Ed.DriveLeftMotor(Ed.FORWARD, Ed.SPEED_5, 5) Drive Edison's left motor forward for 2000 milliseconds at speed 7. Ed.DistanceUnits = Ed.TIME Ed.Tempo = Ed.TEMPO_MEDIUM #--------Your code below----------- Ed.DriveLeftMotor(Ed.FORWARD, Ed.SPEED_7, 2000) Set speed and distance with variables. Ed.DistanceUnits = Ed.CM Ed.Tempo = Ed.TEMPO_MEDIUM #--------Your code below----------- driveSpeed=5 driveDistance=10 Ed.DriveLeftMotor(Ed.FORWARD, driveSpeed, driveDistance) Watch out for: Distance units of CM and INCH are only available for Edison V2.0 and V3.0. If you are using a V1 Edison, please make sure that Ed.DistanceUnits = Ed.TIME. The Ed.TIME constant is in milliseconds. When Ed.DistanceUnits = Ed.TIME, remember that the distance input integer is milliseconds. Example: to drive for 2 seconds, a distance of 2000 should be input. When Edison is turning and Ed.DistanceUnits is set to CM or INCH, distance becomes the number of degrees to turn with a maximum value of 360. If you put in a value above 360, the code will wrap the value around and Edison will perform a shorter turn. Example: an input of 380 will cause Edison to turn 20 degrees. Ed.SPEED_FULL turns Edison's motors up to the maximum value. As such Edison has no control over the speed and Edison V2.0s/V3.0s will not be able to use their encoders to correct for driving drift. Setting distance to 0 or Ed.DISTANCE_UNLIMITED makes Edison turn on the motors and move on with the code. An additional Ed.Drive() will be required later in the code to stop or change the direction of movement. When the distance input is set to anything other than 0 or Ed.DISTANCE_UNLIMITED, Edison will drive for the full distance supplied before moving on to the next line of code. Ed.LeftLed(state) Edison compatibility: V1V2V3 Parameters: State: Ed.ON - LED turns on Ed.OFF - LED turns off Returns: N/A Explanation: Turns Edison's left LED on or off. Examples: Quick flash of left LED. #--------Your code below----------- Ed.LeftLed(Ed.ON) Ed.TimeWait(500, Ed.TIME_MILLISECONDS) Ed.LeftLed(Ed.OFF) Ed.TimeWait(500, Ed.TIME_MILLISECONDS) Left LED on while driving. #--------Your code below----------- Ed.LeftLed(Ed.ON) Ed.Drive(Ed.FORWARD, Ed.SPEED_5, 10) Ed.LeftLed(Ed.OFF) Watch out for: If used to turn Edison's LED on, another function call is needed later in the code to turn Edison's LED off.”
Teacher Guide & Tips
- Use this packet as a 30-minute introduction to Edison robot motor and LED control.
- Discussion question: How might you use variables to make your robot's movements more dynamic?
- For struggling learners, focus on the basic drive commands and the concept of ON/OFF for LEDs before introducing distance units.
- Advanced students can explore combining drive commands with other functions like Ed.TimeWait to create more complex movement sequences.
- Estimated time: 30 minutes
What is Diffit?
Teachers use Diffit to get quality materials for their unique classrooms. Adjust difficulty, add scaffolds, or change the topic to get started.
Try Diffit for free“Create notes slides for the following information: Ed.DriveLeftMotor(direction,speed,distance) and Ed.DriveRightMotor(direction, speed, distance) Edison compatibility: V1V2V3 Parameters: Direction: Ed.FORWARD - Edison's left motor drives forwards. Ed.BACKWARD - Edison's left motor drives backwards. Ed.STOP - Stops Edison's left motor immediately. Speed: A positive integer number between 1-10. Ed.SPEED_1 - PWM controlled speed 1. Ed.SPEED_2 - PWM controlled speed 2. Ed.SPEED_3 - PWM controlled speed 3. Ed.SPEED_4 - PWM controlled speed 4. Ed.SPEED_5 - PWM controlled speed 5. Ed.SPEED_6 - PWM controlled speed 6. Ed.SPEED_7 - PWM controlled speed 7. Ed.SPEED_8 - PWM controlled speed 8. Ed.SPEED_9 - PWM controlled speed 9. Ed.SPEED_10 - PWM controlled speed 10. Ed.SPEED_FULL - Full power to the motors. (Please note- Edison may not drive perfectly straight with this setting.) Distance: An integer number for distance. The maximum value is 32767. OR Ed.DISTANCE_UNLIMITED - turns on Edison's motors and moves on with the code. (Note: a stop will be needed later in the code.) If using an integer number, note that the unit value of this number is set by Ed.DistanceUnits in the setup code. You can change the unit value by changing what Ed.DistanceUnits is set to in the setup code. Ed.DistanceUnits = Ed.CM - distance in centimetres (default for V2.0 and V3.0). Ed.DistanceUnits = Ed.INCH - distance in inches. Ed.DistanceUnits = Ed.TIME - distance in milliseconds (default for V1). Returns: N/A Explanation: Controls Edison's left motor to create movement. This can be set to move for a set distance (CM or INCH) or time period (TIME) and will drive the full distance before moving onto the next line of code. Examples: Drive Edison's left motor forward for 3 cm at speed 5. (Edison V2.0 and V3.0 only) Ed.DistanceUnits = Ed.CM Ed.Tempo = Ed.TEMPO_MEDIUM #--------Your code below----------- Ed.DriveLeftMotor(Ed.FORWARD, Ed.SPEED_5, 3) Drive Edison's left motor forward for 5 inches at speed 5. (Edison V2.0 and V3.0 only) Ed.DistanceUnits = Ed.INCH Ed.Tempo = Ed.TEMPO_MEDIUM #--------Your code below----------- Ed.DriveLeftMotor(Ed.FORWARD, Ed.SPEED_5, 5) Drive Edison's left motor forward for 2000 milliseconds at speed 7. Ed.DistanceUnits = Ed.TIME Ed.Tempo = Ed.TEMPO_MEDIUM #--------Your code below----------- Ed.DriveLeftMotor(Ed.FORWARD, Ed.SPEED_7, 2000) Set speed and distance with variables. Ed.DistanceUnits = Ed.CM Ed.Tempo = Ed.TEMPO_MEDIUM #--------Your code below----------- driveSpeed=5 driveDistance=10 Ed.DriveLeftMotor(Ed.FORWARD, driveSpeed, driveDistance) Watch out for: Distance units of CM and INCH are only available for Edison V2.0 and V3.0. If you are using a V1 Edison, please make sure that Ed.DistanceUnits = Ed.TIME. The Ed.TIME constant is in milliseconds. When Ed.DistanceUnits = Ed.TIME, remember that the distance input integer is milliseconds. Example: to drive for 2 seconds, a distance of 2000 should be input. When Edison is turning and Ed.DistanceUnits is set to CM or INCH, distance becomes the number of degrees to turn with a maximum value of 360. If you put in a value above 360, the code will wrap the value around and Edison will perform a shorter turn. Example: an input of 380 will cause Edison to turn 20 degrees. Ed.SPEED_FULL turns Edison's motors up to the maximum value. As such Edison has no control over the speed and Edison V2.0s/V3.0s will not be able to use their encoders to correct for driving drift. Setting distance to 0 or Ed.DISTANCE_UNLIMITED makes Edison turn on the motors and move on with the code. An additional Ed.Drive() will be required later in the code to stop or change the direction of movement. When the distance input is set to anything other than 0 or Ed.DISTANCE_UNLIMITED, Edison will drive for the full distance supplied before moving on to the next line of code. Ed.LeftLed(state) Edison compatibility: V1V2V3 Parameters: State: Ed.ON - LED turns on Ed.OFF - LED turns off Returns: N/A Explanation: Turns Edison's left LED on or off. Examples: Quick flash of left LED. #--------Your code below----------- Ed.LeftLed(Ed.ON) Ed.TimeWait(500, Ed.TIME_MILLISECONDS) Ed.LeftLed(Ed.OFF) Ed.TimeWait(500, Ed.TIME_MILLISECONDS) Left LED on while driving. #--------Your code below----------- Ed.LeftLed(Ed.ON) Ed.Drive(Ed.FORWARD, Ed.SPEED_5, 10) Ed.LeftLed(Ed.OFF) Watch out for: If used to turn Edison's LED on, another function call is needed later in the code to turn Edison's LED off.”
Teacher Guide & Tips
- Use this packet as a 30-minute introduction to Edison robot motor and LED control.
- Discussion question: How might you use variables to make your robot's movements more dynamic?
- For struggling learners, focus on the basic drive commands and the concept of ON/OFF for LEDs before introducing distance units.
- Advanced students can explore combining drive commands with other functions like Ed.TimeWait to create more complex movement sequences.
- Estimated time: 30 minutes
Edison Robot Drive Commands
This 1-page packet explains how to use the Ed.DriveLeftMotor and Ed.LeftLed commands to control an Edison robot. It's designed for 9th graders learning basic robotics programming and includes explanations of parameters, compatibility notes, and code examples.
What is Diffit?
Teachers use Diffit to get quality materials for their unique classrooms. Adjust difficulty, add scaffolds, or change the topic to get started.
Try Diffit for free