Examples - HowTo - Classes

C++ Library

This Howto shows how to build a class library using c++ for the Wiring- or Arduino-Board.

Download:
LED.zip

View Source:
Arduino Sketch
LED.h
LED.cpp



//  Led Class
//  By Hannes Oswald at CAAD Arch EtHZ, 04.02.2009
//  Created for learning purposes


HOW TO MAKE THIS EXAMPLE RUNNING:
***************************************

1) Copy LED folder to Arduino --> hardware --> libraries
2) Restart Arduino
3) select  file --> sketchbook --> examples --> sos
4) upload to board



HOW TO BUILD A LIBRARY?
***************************************

How the elements work together:
---------------------------------------------------
.h file is the header file
 here you declare all the methods and vars your class is using

.cpp file is the actual code file
 here you write your code similar to as you would do it in arduino

keywords.txt is used to add color highlighting for your class in
 arduino. Categorie 1 highlights in orange, categorie 2 in brown.

.o file is the compiled result of the .cpp file
 you can not make changes here -> read how to run your own class

example files in subfolders of example-folder will appear in arduino
 file --> sketchbook --> examples --> yourClass
 as our example 'sos'



How to run your own class :
---------------------------------------------------
If you want to build your own class, or make changes to
this one, you need to compile your own files. Delete the
existing .o file and restart Arduino-programm. At startup
Arduino compiles your .cpp file to a new .o file,
and displays eventual warnings or errors.


HAVE FUN

This website has been archived and is no longer maintained.