Vorpal Robotics Wiki
Log in

Difference between revisions of "Scratch Example Hello World"

From Vorpal Robotics Wiki
(Code)
(Code)
Line 3: Line 3:
  
 
==Code==
 
==Code==
[[File:Scamp-Leg-Raised.jpg|left|350px|Vorpal The Hexapod Robot]]
+
[[File:Hello-World.JPG|500px|Scratch Hello World Program]]
  
 
==Explanation==
 
==Explanation==

Revision as of 20:36, 25 July 2018

Purpose

This is a very simple Scratch program that will make Vorpal wave hello. It's a great way to get started.

Code

Scratch Hello World Program

Explanation

  • WHEN GREEN FLAG CLICKED: This block means that the program will start running when the green flag button (upper right corner of the scratch screen) is clicked. It just gives you a simple way to start the program.
  • REPEAT 3: This is a control block that causes the blocks inside it to execute three times in a row. You could get the same effect by simply repeating the blocks three times, but that would be more time consuming, plus by using the repeat block you can easily change the number of times Vorpal waves.
  • SET LEGS (two blocks): These two blocks actually make Vorpal wave. The first SET LEGS block moves leg number zero (front left leg) so that the knee puts the leg up in the air, but also sets the hip back a little. This movement is held for 0.2 seconds, just a short time. The second block leaves the leg up in the air but moves the hip forward, again for 0.2 seconds. Don't worry about the meaning of "mirror hips" yet, we will get to that in more advanced programs.
  • STOP: The stop block at the end resets Vorpal to a standing position and shuts down any other activities that might have been happening at the end of the program. It's always a good idea to end every program with a STOP block.