Line Follow Robot Step-by-Step in Scratch



Start Scratch and Delete the Cat

1. Click the Scratch Cat Icon one time.
2. Click the Scissors and click the Cat one time to delete.
   


Make the BugBot Sprite:

3. Click "Paint New Sprite" icon and create the following Drawing:



    (Your Sprite must have a Red and a Blue antenna to work)

4. Click "OK"

Name the Sprite:

5. Click on your new Sprite on time
6. Name your Sprite "BugBot"
 


Draw the line to follow:

7. Click "Paint New Sprite"
8.  Click the "Zoom Out" icon one time
 


9. Click the Paintbrush tool.
  


10. Select Color Black (Should be default)
11.  Draw a gentle S line
12. Click OK



Program the BugBot:

13. Click the BugBot Sprite one time.
14. Click the Control Icon one time
    


15. Drag a "When Green Flag Clicked" into the Scripts Pane
 


16. Drag a yellow "Forever" and attach it to the "When Green Flag Clicked"
   


17. Click on "Motion"
   


18. Drag "Move 10 steps" into the Forever.

  

19. Change the 10 to 2
  


20. Click on Control. Drag an "If" block under the "Move 2" Block
   


21. Click on "Sensing"
   


22. Drag a "If Color is over color" block and put it into the hexagon of the "If."
  


23. Click the first color and then click the Red Antenna of the BugBut
24. Click the second color and then click the black line.
25. It should say "If Color 'Red' is over Color 'Black'"
  


26. Click on "Control"
27. Put a "Turn CounterClockwise (Left) 15 degrees" block in the "If"
 


28. Change 15 to 5 Degrees
   


Repeat steps for Blue Antenna:

29. Put another "If" into the Forever Loop
  


30. Click Sensing and put a "Color over Color" block in the 2nd "If"
  


31.  Click the 1st color and select the Blue Antenna.
32.  Click the 2nd color and select the Black Line.
33.  Put a Turn Clockwise (Right) 15 degrees block in the 2nd "If"
  


34. Change 15 to 5 degrees.
35. Your Script should look like this:
  


Run and Save:
36.  Drag your BugBot to the line.
37.  Click the Green Flag and your BugBot should follow the line.
38.  Click "Save" and Save as "Lastname LineFollow" in the Tech Club Folder.