1020: Introduction to Programming Winter 2014

Assignment 0

Due: Jan. 20, 2014 at 12:00 noon.

This assignment will not be graded, but you are required to complete it and submit it regardless. This is intended to ensure that you know how to submit your assignments correctly and to help resolve any technical issues before it becomes important and your assignments are worth something.


The primary piece of software for programming is known as the "Development Environment", which includes a collection of tools for creating, editing, compiling, testing and debugging programs as well as supporting libraries used by your program. There are many good development environments available, including Visual Studio, XCode and Eclipse. While these are mostly equivalent for our purposes, and code written using any of them should work just fine on another, they each have their idiosyncracies so in most situations where code in a project will be written by more than one person or will be written by one and tested by another it is strongly advised to standardize on a particular development environment.

In this course, we have chosen an open-source cross-platform environment that will provide both a low-cost solution, and a platform agnostic solution. This will keep costs down for you, the student.

The purpose of this assignment is to get you familiarized with the development environment and have all aspects of the environment working properly.

Part 1 - Executable

This part of the assignment should be done individually. In this part of the assignment you will modify, compile, and execute a simple program composed of the following three files:

You will edit assign0.cpp so that the comment block contains your own name and student number and so that it prints your name.

After you have tested your program and are confident it is right, you will submit the assignment using a web-based submission system.

Detailed Instructions

  1. Start Eclipse.
  2. Create a new workspace by (a) selecting Browse, (b) creating a folder called "workspace" in your "My Documents" folder, and (c) selecting that folder as your workspace. Note that on LabNet computers this will appear as the H: drive, so your workspace should be H:\My Documents\workspace
  3. Create a C++ project in Eclipse for this assignment (call it A0). Be sure to select "Empty Project" under "Executable" for project type and the MinGW GCC or MacOSX GCC toolchain.
  4. Download the three files a0main.cpp, assign0.h, & assign0.cpp and save them in the project folder My Documents\workspace\A0 in your workspace
  5. Select the project (A0) in the Eclipse "project explorer" view (on the left) and press the F5 key to refresh the project.
  6. Edit assign0.cpp by double clicking on it in the "project explorer" view.
  7. Change the comment block to contain your name, login name, student number, section number, and the due date.
  8. Look for the line
    cout << "Your Name";
    Change the text between the quotes to be your name.
  9. Save the file by pressing ctrl-s or by the "File -> Save" menu item.
  10. Build the project by the "Project -> Build All" menu item or the (build) toolbar button.
  11. Check the "console" view at the bottom, for any errors.
  12. Run the project by the "Run -> Run" menu item or the (run) toolbar button.
  13. If the output (in the "console" view at the bottom) is "Hello your name", where "your name" is replaced by your name, then your program runs correctly.
  14. Submit the file H:\My Documents\workspace\A0\assign0.cpp using websubmit.

Part 2 -- Pololu 3pi

This part of the assignment should be done in your programming pairs. In this part you will modify a simple C++ program and compile it and run it on the Pololu 3pi. The program is contained in assign0_3pi.cpp (only one file this time). Here are the detailed instructions (assuming that you've created a workspace and have all the tools installed correctly).

  1. Create a C++ project, this time selecting "Empty Project" under "AVR Cross Target Application".
  2. Ensure that pololu_atmega328p is specified as a required library for the project.
  3. Download the file assign0_3pi.cpp and save it in the project folder under My Documents\workspace\
  4. Edit assign0_3pi.cpp to fix the comment block and change the message to something that identifies you.
  5. Compile the program ()
  6. Ensure that your 3pi has fresh batteries installed correctly, is turned on and is connected to the programmer, which is connected to the PC USB port.
  7. Download your program to the 3pi by selecting the (AVR) button, it should start to execute immediately.

Please DO NOT submit this code. If it works for you then that's good enough.

Last modified $LastChangedDate: 2014-01-09 13:57:57 -0330 (Thu, 09 Jan 2014) $