Software Archive
Read-only legacy content
17061 Discussions

Eclipse For Edison and including Arduino libs

Mike_M_3
Beginner
1,319 Views

I installed the Eclipse Dev Environment for my Edison. Tried the first example and it worked.  I then tried a multi-threaded example and that worked as well. So now i would like to move onto controlling the I/O. In looking at the Arduino files and i see they have many source files for SPI, I2C, GPIO and so on. Are these files not included into the Dev build  because Arduino created them ?

It would be nice to have source files for I/O included, so we are not tied to the Arduino dev environment.

 

 

 

 

0 Kudos
9 Replies
Stewart_C_Intel
Employee
1,319 Views

Did you include the IOT devkit version of Eclipse with samples?  The source for the libs is on Github, and like Arduino, abstracts the h/w so the same C/C++ code runs on Gen1, Gen 2 and Edison.  Easiest way to find the libraries is to go to any of our sensor pages on software.intel.com/iot, and click on the "add your own sensor, clone our repository" once there, look at examples, they have a lot more sensors enabled.  Libraries are pre-installed on our board images, so they are linked at run-time. With the Arduino each sketch includes and compiles the libraries from source. Same effect, different deployment.

http://iotdk.intel.com/ is the source of all this goodness. ie the top of the tree, libraries, SD card images, source files for the Yocto packages, and opkg repositories that are more up to date than the SD image we have on the IOT site.

 

 

0 Kudos
Mike_M_3
Beginner
1,319 Views

>Did you include the IOT devkit version of Eclipse with samples?

I believe so, I downloaded and installed the file iotdk-ide-win.7z.

In the links you gave i went here to try this example because i really want to be able to use mraa.

https://github.com/intel-iot-devkit/mraa/blob/master/examples/spi_mcp4261.c

 

Eclipse does not complain about not finding #include "mraa.h"

yet in main it errors on mraa_init(); saying undefined reference.

In looking in the eclipse project list, there is an example for 5_cpp_mraa_analog_input

This one includes #include "mraa.hpp" instead of mraa.h and does not use mraa_init(); in main.

Which one is the proper way.

 

 

0 Kudos
Matthias_H_Intel
Employee
1,319 Views

for C++ projects you can use either mraa.h or mraa.hpp. For C projects you need to use mraa.h.

How do you compile? (C or C++ project)?

0 Kudos
Brendan_L_Intel
Employee
1,319 Views

Make sure you are linking against -lmraa. The headers for libmraa are in the standard /usr/include so will always be found however the linker will not 'guess'.

0 Kudos
Mike_M_3
Beginner
1,319 Views

Brendan Le Foll (Intel) wrote:

Make sure you are linking against -lmraa. The headers for libmraa are in the standard /usr/include so will always be found however the linker will not 'guess'.

Thanks! adding -lmraa was the ticket!

hopefully i wont embarrass my self to much by asking how did you know to add that to the linker ?

 

 

0 Kudos
Matthias_H_Intel
Employee
1,319 Views

Mike M. wrote:

Quote:

hopefully i wont embarrass my self to much by asking how did you know to add that to the linker ?

you might find a part of the answer by running

head -n 2 /usr/include/mraa.h

in your console ;-)

0 Kudos
GGerh
New Contributor I
1,319 Views

Hi, does anybody manged an rx/tx read/write on pin 0 and 1 on the arduino dev kit in nativ c/c++ ? i would like to use the arduino gsm shield but not the arduino ide... i would like to programm a daemon for yocto in eclipse. unfortunately the mraa library only provides a init script for the uart... also tried to compile with arduino libraries by copie them to the hardware folder of the dev kit... so i could use the TTYUARTClass but that didn't worked neither...

Thanks in Advance

0 Kudos
Stan_G_
Beginner
1,319 Views

https://communities.intel.com/message/247139#247139 explains the Serial port mapping;

 

Pins 0,1 map to /dev/ttyMFD1

When I interfaced an adafruit GPS to pins 0,1 I just googled for standard linux code and changed the dev in the example.

Worked first go - I am at work so cannot post the code/link - but use google.

Stan

 

0 Kudos
Stan_G_
Beginner
1,319 Views

This is the link - more or less just copy/pasted, changed the /dev setting (and baud rate) and it worked first go:

 

http://www.tldp.org/HOWTO/Serial-Programming-HOWTO/x115.html

0 Kudos
Reply