Schedule‎ > ‎

Lab 16: Making a Library Class


  • Code an Arduino library class
  • Describe what is meant by a header file
  • Describe what is meant by an implementation file

^ top

Academic Honesty

Read the Scholastic Honesty Policy and Assignment Integrity policies of the syllabus. Here are some clarifications for this particular assignment:

  • You may discuss the code with other students for this lab.
  • You must enter all the code yourself and not copy from another student.

^ top

Part 1: Morse Code Flasher

In this project we create an Arduino library class.


  1. Start a new sketch and save the program as sos. New button
  2. Complete the lab at Writing a Library for Arduino, referring to the Notes and Hints below as needed.
  3. Make sure to include the keywords.txt file.
  4. Place the sos folder into the examples folder.
  5. Zip the Morse folder and submit the ZIP file as part of this lab.

Notes and Hints

  • You can also reference the notes from the 11B lecture where we created a library.
  • Make a new tab by clicking the down arrow image on the tab bar and selecting "New Tab"
  • The first item (left most) in the Arduino IDE must be a .ino file.
  • If you have problems finding the Sketchbook library, refer to lesson 11B.
  • To create the Morse library:
    1. After creating a new tab, enter the name for the new files as Morse.h for the header file and Morse.cpp for the implementation file.
    2. After writing the header (.h), implementation (.cpp) and main (.ino) files, exit the Arduino IDE.
    3. Find your library folder and create a folder therein named "Morse" (without the quotes)
    4. Copy or move the Morse.h and Morse.cpp files to the new folder in the library.
    5. While copying or moving the files, verify the Arduino IDE did not add a .ino extension to the files. If so, then remove the .ino extension.
    6. Add the library by starting the Arduino IDE and navigating to the menu:
      Sketch > Include Library > Add .ZIP Library
      Then select the Morse folder.
  • When creating the keywords.txt file, be sure to have only a single tab between the keyword and the type of keyword.

^ top

Grading Criteria (10)

10 pts:  headers 2pts. zip file 2pts, can add your sos library to Arduino IDE 2pts, can compile & run your sample sos program 2 pts,  morse class and methods in color 2 pt.

  • with all files in the correct folder structure and including the files:
    • Morse.h
    • Morse.cpp
    • sos.ino
    • keywords.txt

^ top