How it works The set memory icon puts the value 10 into the variable named The program then ‘pen’. enters a loop. The loop is set to end when the value in the variable is equal to zero. ‘pen’ As the value in is not zero the loop starts. ‘pen’ The first icon in the loop is the single drive icon and sets the direction that the pen moves. This moves the pen for 0.01 of a second, which is set by the event wait icon and the next single drive icon. The minus count icon subtracts 1 from and the loop again tests ‘pen’ whether equals zero. This loop will repeat 10 times until is equal to zero. The ‘pen’ ‘pen’ program will then move on. The that is put into before the loop starts determines how long the line will be. In ‘pen’ this program the pen moves 10 times. Each movement of the pen is about 2.5mm (0.1 inches), so our line is about 2.5cm (1 inch) long. The direction of the pen is set by whether the single drive icon is set to Backwards or Forwards. Draw a vertical line (move paper) This is a loop from the above program that moves the paper to draw a vertical line.
How it works The set memory icon puts the value 10 into the variable named ‘pen’. The program then enters a loop. The loop is set to end when the value in the variable ‘pen’ is equal to zero. As the value in ‘pen’ is not zero the loop starts. The first icon in the loop is the single drive icon and sets the direction that the pen moves. This moves the pen for 0.01 of a second, which is set by the event wait icon and the next single drive icon. The minus count icon subtracts 1 from ‘pen’ and the loop again tests whether ‘pen’ equals zero. This loop will repeat 10 times until ‘pen’ is equal to zero. The program will then move on. The that is put into ‘pen’ before the loop starts determines how long the line will be. In this program the pen moves 10 times. Each movement of the pen is about 2.5mm (0.1 inches), so our line is about 2.5cm (1 inch) long. The direction of the pen is set by whether the single drive icon is set to Backwards or Forwards. Draw a vertical line (move paper) This is a loop from the above program that moves the paper to draw a vertical line.
EdBook3-Your-EdVenture-into-Robotics-You-re-a-Builder.docx