I'm experimenting something new with my Arduino Leonardo. I removed its original bootloader and flashed it with LUFA mass storage example with added functionalities(now its a firmware). I'm trying to now add RFID reader(read/write) example to my firmware. For that I have to convert the sketch to a c++ code. So I copied relevant header file and cpp file from the library folder(libraries->rfid-master->bla.h,bla.cpp). But I'm confused what to do with the .ino file under examples(libraries->rfid-master->examples->ReadAndWrite->blabla.ino). I guess this code should be copied to the main class of my firmware. Any ideas?
Basically *.ino is *.cpp without headers. So you can
- rename it to *.cpp,
- If you have any functions which are used before they have been defined, provide declarations for each function before its first use
#include <Arduino.h>on the top
#include <Wire.h>if you are using Wire and so on
and you have "normal" CPP file.
If you are making library this way, than you create also *.h file, where you declare all exported functions and objects and #include that file in your *.cpp as first line (than you do not need/have to forward declare any of that exported functions)
the Bare Arduino have 2 projects each using 2 libraries, so you can get inspiration there