8.1.3 - Test Program

Select the test program from the Examples window on the left.

The test program looks like this:

#-------------Setup---------------- import Ed Ed.EdisonVersion = Ed.V2 Ed.DistanceUnits = Ed.TIME Ed.Tempo = Ed.TEMPO_MEDIUM #--------Your code below----------- while True: Ed.PlayBeep() Ed.LeftLed(Ed.OFF) Ed.RightLed(Ed.ON) Ed.Drive(Ed.SPIN_RIGHT, 5, 350) Ed.TimeWait(20, Ed.TIME_MILLISECONDS) Ed.PlayBeep() Ed.LeftLed(Ed.ON) Ed.RightLed(Ed.OFF) Ed.Drive(Ed.SPIN_LEFT, 5, 350) Ed.TimeWait(20, Ed.TIME_MILLISECONDS)

Edison looks at each line at a time and does what the line says. Blank lines or comment lines are ignored.

Each line here is calling the built-in Edison commands. You can explore each of the commands by searching in the Documentation window.

In Python, commands may have parameters that are passed into them to specify inputs for the command to use. For example, the Ed.RightLed() command takes one input which is telling the LED whether it should turn ON (Ed.ON) or OFF (Ed.OFF).

The Ed.PlayBeep() command has no input parameters. In the Ed.TimeWait() command there are 2 input parameters – the first for the amount of seconds or milliseconds to wait, and the second parameter for the unit of time (milliseconds or seconds).

For an exercise find how many parameter inputs do each of the following commands have:

  • Ed.PlayBeep()
  • Ed.TimeWait()
  • Ed.LeftLed()
  • Ed.DriveRightMotor()