Arduino will not work in a clean C setup, as this requires a C ++ compiler. However, if you want to include the arduino kernel and other libraries inside your project, then read it. Here we see how to use the Arduino Ethernet Library with our code.
STEP BY STEP
- Get Arduino Kernels and Options / Files.
- Get the appropriate library, for example. Ethernet Arduino Library.
Directory structure
- /
- Library / Arduino / Cores
- Library / Arduino / options // pins_arduino.h
- Library / Arduino / Makefile
- Library / Arduino / build
- Library /
Sample file can be downloaded from: https://gist.github.com/rjha/b7cda6312552c3e15486
First create the Arduino core as a static library. For this:
- $ cd to lib / arduino folder
- $ make clean
- $ make lib
This will create a static library file lib / arduino / build / libarduino.a.
Next, we move on to the main project Makefile project. There we can define any Arduino library, for example. Arduino SPI or Arduino Ethernet as the target that will compile with the Arduino core library.
Inside our own target, we can include the Arduino Target, which in turn includes the Arduino core.
For example (7) and (8) see this meaning
https://gist.github.com/rjha/e7b123d3dc4346b5830c
(9) when creating hexadecimal and general links, use the -larduino link and save libarduino.a in the PATH search engine. @see above Gist for an example.
(10) Using this structure, you can use any Arduino libraries inside your own code.
Most Arduino libraries are mutant dependencies, and the quality of the code is also poor. The only advantage is that you can get ready-made libraries for links to your code.
source share