user29168: 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?

user15180: 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)
You may like to take a look at https://github.com/arduino/Arduino.git https://github.com/sudar/Arduino-Makefile and https://github.com/ladislas/bare-arduino-project
the Bare Arduino have 2 projects each using 2 libraries, so you can get inspiration there

29168: <p>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?</p>
 15180: <p>Basically *.ino is *.cpp without headers. So you can </p>

<ul>
<li>rename it to *.cpp,</li>
<li>If you have any functions which are used before they have been defined, provide declarations for each function before its first use</li>
<li><code>#include &lt;Arduino.h&gt;</code> on the top </li>
<li><code>#include &lt;Wire.h&gt;</code> if you are using Wire and so on</li>
</ul>

<p>and you have "normal" CPP file.</p>

<p>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)</p>

<p>You may like to take a look at <a href="https://github.com/arduino/Arduino.git" rel="nofollow noreferrer">https://github.com/arduino/Arduino.git</a> <a href="https://github.com/sudar/Arduino-Makefile" rel="nofollow noreferrer">https://github.com/sudar/Arduino-Makefile</a> and <a href="https://github.com/ladislas/bare-arduino-project" rel="nofollow noreferrer">https://github.com/ladislas/bare-arduino-project</a></p>

<p>the Bare Arduino have 2 projects each using 2 libraries, so you can get inspiration there</p>
