HELLO, WORLD!
In this project, we'll write our first code.

It’s customary in the programming world that the very first program you write is called, “Hello, World!” The purpose of this program is simple – have the computer print the words, “Hello, World!” on the screen.

We’re not ones to buck tradition, so we’re going to make “Hello, World!” our very first project. The nice thing about this project is that it’s easy to do (it’s only one line of code) and it will give us an opportunity to start exploring our RaspberrySTEM Development Environment (RDE).

What is Programming?

Programming is the process of writing instructions for a computer to follow. You write these instructions using an editing tool (we provide a custom editing tool as part of the RaspberrySTEM CREATOR Kit) and then "send" those instructions to the the computer to carry out (or "execute"). Just like there are lots of different languages that people can speak, there are also many languages that computer instructions can be written in -- each of which will ultimately be converted into a format that the computer understands.

The RaspberrySTEM CREATOR Kit supports many different programming languages, but we will primarily be focused on one of the most common, called Python. Python is a versatile language that is used in both the academic and the professional world to build a varied set of applications and tools. Learning how to program in the Python programming language will provide a solid foundaiton for all future programming education.

Here are step-by-by instructions for implementing this project; after we’ve completed it, we’ll talk more about how and why it works.


Step #1: Find the Code Window on Your RDE

All the code you will be writing as part of the RaspberrySTEM projects will be done within the RDE. Specifically, you’ll be writing your code in the Code Window portion of the RDE. As a reminder, here is where the Code Window is located:



You’ll notice that at the top left corner of the Code Window, there is a line numbered “1”. This is where you will type in your program’s code:



Step #2: Enter Your Code in The Code Window

It's now time to enter the code for this project. In the code window, enter the following:



A few things worth noting at this point:


Step #3: Run Your Code

Now that you’ve typed (or cut-and-pasted) the line of code into the Code Window, let’s see if it works. We do this by “running” the program. To run the program, click on the Play icon () at the top of the Code Window.

The program runs by starting at the first line, doing what that line says (“executing” that line), and then moving on to the next line. It does that until it reaches the bottom. In this case, we only have one line, so only that line of code is executed.

It may take a few seconds for the code to run, and you may notice two things during this time:

  1. The the triangular PLAY icon turns to a square; and

  2. That the little RaspberrySTEM icon at the top of the code window spins.

These are just indications that the Raspberry Pi is busy running your code. And don't worry if you don't notice these things -- sometimes they happen so fast they they're not very noticeable.


Step #4: Verify the “Output” of Your Code

If you’ve done everything correctly, you should see the following in your Output Window (the window in the lower left of the RDE, below the Code Window):


Hello, World!
-- PROGRAM FINISHED --

The first line of the output window is the result of the code you’ve written – you’ve successfully had the computer print the words “Hello, World!”

The last line indicates that the program is finished running – this will be helpful later when you’re writing longer and more complicated programs.

Congratulations! You’ve just written your first program!

But wait! What if the output from your program doesn't look like it's supposed to? Or if you get a jumbled red and black error-looking message in the Output Window? If that's the case, you likely have an error in your code. But, even if your code worked perfectly and you didn't get any errors in your code above, we highly recommend reading the next section, as you're certain to encounter programming errors at some point:

Click here to read about handling errors in your code...

home | prev | next