Go Down

Topic: Arduino Due libraries (official and 3rd party) (Read 235411 times) previous topic - next topic

transmissions4less

Eigen is a C++ library enabling Matlab and Octave-like matrix programming.  Eigen works very well with the Arduino Due.  As a Matlab user that appreciates minimalism, the Eigen library is written as plain header files. So no makefiles, no binary files, nothing to compile upfront, no headaches.
 
I downloaded it and tried on arduino 1.8 still no luck , appreciate any help


phr3ak

can you please recommend spi eeprom library for due?

ApNair

Dear friends,


 I am in a big trouble, I designed a sensor system by interfacing AD 7705 ADC with ATMGA328P-AU.All the library files i downloaded from (http://www.kerrywong.com/2012/04/18/ad7705ad7706-library-revisited/ )
And it is working fine.

   Now i want to  change the controller to 32 bit SAM3x8e. The old library we used for AD7705 is not supporting. I am new with this controller, is there any one  to help me to find the solution. Can you suggest what change i should make in the old library.

hoping some one will help me .....................

Thank you..............

ard_newbie


IMO if you are not yet familiar with the DUE, I suggest that you begin with a code like this one:
http://forum.arduino.cc/index.php?topic=19963.0
and the AD7705 datasheet, until you succeed to read properly the AD conversions at a very low frequency using digitalRead / digitalWrite.

You will find the correct CPOL/CPHA combination thanks to the figures in the AD datasheet.
then you can adapt your code for the Sam3x8e SPI controller with a much higher frequency using direct register programming or SPI.h or TurboSpi.h if necessary.


potasheyt

Can someone show me how to use MFRC 522 on arduino DUE? it's running on nano uno and mega. but i cant make it work on DUE. my project need to use DUE and not other arduino. so please can anyone teach me how. im new in using arduino DUE. TIA

alcazar_juanc

I need to use a complex math library for a school project. I found a library of that kind in this link: https://playground.arduino.cc/Main/ComplexMath but it doesn't compile in Arduino DUE. I think that I need to change something in either complex.cpp or complex.h but I don't know what to change.

When I try to upload the complex example of this library mentioned above, the following errors appear:

complex:16: error: 'COMPLEX_LIB_VERSION' was not declared in this scope

Serial.println(COMPLEX_LIB_VERSION);

              ^
complex:19: error: 'Complex' was not declared in this scope

Complex c1(10.0, -2.0);

^

complex:19: error: expected ';' before 'c1'

Complex c1(10.0, -2.0);

       ^
complex:20: error: expected ';' before 'c2'

Complex c2(3, 0);

       ^
complex:21: error: expected ';' before 'c3'

Complex c3(-10, 4);

       ^
complex:22: error: expected ';' before 'c4'

Complex c4(-5,-5);

       ^
complex:23: error: expected ';' before 'c5'

Complex c5(0, 0);

       ^
complex:25: error: 'one' was not declared in this scope

Serial.println(one);

              ^
complex:26: error: 'c1' was not declared in this scope

Serial.println(c1);

              ^
complex:27: error: 'c2' was not declared in this scope

Serial.println(c2);

              ^
complex:28: error: 'c3' was not declared in this scope

Serial.println(c3);

              ^
complex:29: error: 'c4' was not declared in this scope

Serial.println(c4);

              ^
complex:36: error: 'c5' was not declared in this scope

c5 = c1;

^

exit status 1
'COMPLEX_LIB_VERSION' was not declared in this scope

Does someone have any idea how to fix it?

I would really appreciate your help by telling me what to change or maybe it would be easier if someone shares the files of a complex library that works in Arduino DUE.

Beforehand thanks a lot.

ard_newbie

#143
Jan 25, 2018, 09:39 am Last Edit: Jan 25, 2018, 09:42 am by ard_newbie
I tried to upload this Library this way, and I think it works (at least, I have no error at compile time):

Open a new sketch that you can call Complex.ino :

Code: [Select]

//
//    FILE: complex.ino
//  AUTHOR: Rob Tillaart
//    DATE: 2013-09-23
//
// PUPROSE: test complex math
//
// Serial.print(Complex) supported since 0.1.05

#include "complex.h"

void setup()
{
  Serial.begin(115200);
  Serial.print("\n  Complex numbers test for Arduino: ");
  Serial.println(COMPLEX_LIB_VERSION);
  Serial.println("\n1. Print Complex, set, real, imag");

  Complex c1(10.0, -2.0);
  Complex c2(3, 0);
  Complex c3(-10, 4);
  Complex c4(-5,-5);
  Complex c5(0, 0);

  Serial.println(one);
  Serial.println(c1);
  Serial.println(c2);
  Serial.println(c3);
  Serial.println(c4);
  c3.set(0,0);
  Serial.println(c3);
  Serial.println(c3.real());
  Serial.println(c3.imag());

  Serial.println("\n2. ==  != ");
  c5 = c1;
  if (c5 == c1) Serial.println("ok :)");
  else Serial.println(" fail :(");
  c5 = c1 + 1;
  if (c5 != c1) Serial.println("ok :)");
  else Serial.println(" fail :(");
  c5 = 3;
  if (c5 == 3) Serial.println("ok :)");
  else Serial.println(" fail :(");


  Serial.println("\n3. negation - ");
  c5 = -c1;
  Serial.println(c5);
  c5 = -c5;
  Serial.println(c5);
  if (c5 == c1) Serial.println("ok :)");
  else Serial.println(" fail :(");


  Serial.println("\n4. + - ");
  c5 = c1 + c2;
  Serial.println(c5);
  c5 = c1 + 3;
  Serial.println(c5);
  c5 = c1 - c2;
  Serial.println(c5);
  c5 = c1 - 3;
  Serial.println(c5);


  Serial.println("\n5. * / ");
  c5 = c1 * c2;
  Serial.println(c5);
  c5 = c5 * 3;
  Serial.println(c5);
  c5 = c5 / c2;
  Serial.println(c5);
  c5 = c5 / 3;
  Serial.println(c5);

  c5 = c1 / c2 * c2;
  Serial.println(c5);
  c5 = c1 * c4 / c4;
  Serial.println(c5);


  Serial.println("\n6. assign += -= *= /=");
  c5 = c1;
  c5 += c1;
  Serial.println(c5);
  c5 += 3;
  Serial.println(c5);
  c5 -= c1;
  Serial.println(c5);
  c5 -= 3;
  Serial.println(c5);
  c5 *= c1;
  Serial.println(c5);
  c5 *= 3;
  Serial.println(c5);
  c5 /= c1;
  Serial.println(c5);
  c5 /= 3;
  Serial.println(c5);


  Serial.println("\n7. phase modulus polar");
  Serial.println(c1);
  double m = c1.modulus();
  Serial.println(m);
  double p = c1.phase();
  Serial.println(p);
  c5.polar(m, p);
  Serial.println(c5);


  Serial.println("\n8. conjugate reciprocal");
  c5 = c1.conjugate();
  Serial.println(c5);
  c5 = c5.conjugate();
  Serial.println(c5);
  c5 = c1.reciprocal();
  Serial.println(c5);
  c5 = c5.reciprocal();
  Serial.println(c5);

  Serial.println("\n9. power: exp log pow sqrt sqr logn log10");
  c5 = c1.c_sqr();
  Serial.println(c5);
  c5 = c1.c_exp();
  Serial.println(c5);
  c5 = c5.c_log();
  Serial.println(c5);
  c5 = c1.c_pow(2);
  Serial.println(c5);
  c5 = c5.c_sqrt();
  Serial.println(c5);
  c5 = c5.c_sqr();
  Serial.println(c5);
  c5 = c1.c_pow(c2);
  Serial.println(c5);
  c5 = c5.c_pow(c2.reciprocal());
  Serial.println(c5);
  c5 = c5.c_logn(c4);
  Serial.println(c5);
  c5 = c4.c_pow(c5);
  Serial.println(c5);
  c5 = c5.c_log10();
  Serial.println(c5);

  Serial.println("\n10. gonio: sin cos tan asin acos atan");
  c1.set(0.5, 0.5);
  c5 = c1.c_sin();
  Serial.println(c5);
  c5 = c5.c_asin();
  Serial.println(c5);
  c5 = c1.c_cos();
  Serial.println(c5);
  c5 = c5.c_acos();
  Serial.println(c5);
  c5 = c1.c_tan();
  Serial.println(c5);
  c5 = c5.c_atan();
  Serial.println(c5);

  Serial.println("\n11. gonio csc sec cot acsc asec acot");
  c1.set(0.5, 0.5);
  c5 = c1.c_csc();
  Serial.println(c5);
  c5 = c5.c_acsc();
  Serial.println(c5);
  c5 = c1.c_sec();
  Serial.println(c5);
  c5 = c5.c_asec();
  Serial.println(c5);
  c5 = c1.c_cot();
  Serial.println(c5);
  c5 = c5.c_acot();
  Serial.println(c5);

  Serial.println("\n12. gonio hyperbolicus I ");
  c1.set(0.5, 0.5);
  c5 = c1.c_sinh();
  Serial.println(c5);
  c5 = c5.c_asinh();
  Serial.println(c5);
  c5 = c1.c_cosh();
  Serial.println(c5);
  c5 = c5.c_acosh();
  Serial.println(c5);
  c5 = c1.c_tanh();
  Serial.println(c5);
  c5 = c5.c_atanh();
  Serial.println(c5);

  Serial.println("\n13. gonio hyperbolicus II ");
  c1.set(0.5, 0.5);
  c5 = c1.c_csch();
  Serial.println(c5);
  c5 = c5.c_acsch();
  Serial.println(c5);
  c5 = c1.c_sech();
  Serial.println(c5);
  c5 = c5.c_asech();
  Serial.println(c5);
  c5 = c1.c_coth();
  Serial.println(c5);
  c5 = c5.c_acoth();
  Serial.println(c5);

  Serial.println("\n.. Complex done");

  uint32_t start = micros();
  for (int i=0; i<1000; i++)
  {
    c5 = c5.c_csc();
  }
  uint32_t dur = micros() - start;
  Serial.println(dur);
  Serial.println(one);
}

void loop()
{
}
//
// END OF FILE
//
/*  OUTPUT:
 *  
 Complex numbers test for Arduino: 0.1.09

1. Print Complex, set, real, imag
1.000 0.000i
10.000 -2.000i
3.000 0.000i
-10.000 4.000i
-5.000 -5.000i
0.000 0.000i
0.00
0.00

2. ==  !=
ok :)
ok :)
ok :)

3. negation -
-10.000 2.000i
10.000 -2.000i
ok :)

4. + -
13.000 -2.000i
13.000 -2.000i
7.000 -2.000i
7.000 -2.000i

5. * /
30.000 -6.000i
90.000 -18.000i
30.000 -6.000i
10.000 -2.000i
10.000 -2.000i
10.000 -2.000i

6. assign += -= *= /=
20.000 -4.000i
23.000 -4.000i
13.000 -2.000i
10.000 -2.000i
96.000 -40.000i
288.000 -120.000i
30.000 -6.000i
10.000 -2.000i

7. phase modulus polar
10.000 -2.000i
10.20
-0.20
10.000 -2.000i

8. conjugate reciprocal
10.000 2.000i
10.000 -2.000i
0.096 0.019i
10.000 -2.000i

9. power: exp log pow sqrt sqr logn log10
96.000 -40.000i
-9166.244 -20028.609i
10.000 -2.000i
96.000 -40.000i
10.000 -2.000i
96.000 -40.000i
880.000 -592.000i
10.000 -2.000i
0.534 0.542i
10.000 -2.000i
1.009 -0.086i

10. gonio: sin cos tan asin acos atan
0.541 0.457i
0.500 0.500i
0.990 -0.250i
0.500 0.500i
0.404 0.564i
0.500 0.500i

11. gonio csc sec cot acsc asec acot
1.078 -0.912i
0.500 0.500i
0.950 0.240i
0.500 0.500i
0.839 -1.172i
0.500 0.500i

12. gonio hyperbolicus I
0.457 0.541i
0.500 0.500i
0.990 0.250i
0.500 0.500i
0.564 0.404i
0.500 0.500i

13. gonio hyperbolicus II
0.912 -1.078i
0.500 0.500i
0.950 -0.240i
0.500 0.500i
1.172 -0.839i
0.500 0.500i

.. Complex done
116805
1.000 0.000i
 
 
 */



and Inside the IDE window, click in the upper right Arrow to open a folder Inside this window that you call Complex.h   . Copy and paste Complex.h from the original library inside Complex.h.

Click again in the upper right Arrow and add a new folder Inside Complex.ino that you call Complex.cpp  . Copy and paste Complex.cpp from the original Library Inside Complex.cpp

Then compile, upload and run  Complex.ino on your DUE.

I did a copy of the results at the end of Complex.ino above.

alcazar_juanc

I tried to upload this Library this way, and I think it works (at least, I have no error at compile time):

Open a new sketch that you can call Complex.ino :

Code: [Select]

//
//    FILE: complex.ino
//  AUTHOR: Rob Tillaart
//    DATE: 2013-09-23
//
// PUPROSE: test complex math
//
// Serial.print(Complex) supported since 0.1.05

#include "complex.h"

void setup()
{
  Serial.begin(115200);
  Serial.print("\n  Complex numbers test for Arduino: ");
  Serial.println(COMPLEX_LIB_VERSION);
  Serial.println("\n1. Print Complex, set, real, imag");

  Complex c1(10.0, -2.0);
  Complex c2(3, 0);
  Complex c3(-10, 4);
  Complex c4(-5,-5);
  Complex c5(0, 0);

  Serial.println(one);
  Serial.println(c1);
  Serial.println(c2);
  Serial.println(c3);
  Serial.println(c4);
  c3.set(0,0);
  Serial.println(c3);
  Serial.println(c3.real());
  Serial.println(c3.imag());

  Serial.println("\n2. ==  != ");
  c5 = c1;
  if (c5 == c1) Serial.println("ok :)");
  else Serial.println(" fail :(");
  c5 = c1 + 1;
  if (c5 != c1) Serial.println("ok :)");
  else Serial.println(" fail :(");
  c5 = 3;
  if (c5 == 3) Serial.println("ok :)");
  else Serial.println(" fail :(");


  Serial.println("\n3. negation - ");
  c5 = -c1;
  Serial.println(c5);
  c5 = -c5;
  Serial.println(c5);
  if (c5 == c1) Serial.println("ok :)");
  else Serial.println(" fail :(");


  Serial.println("\n4. + - ");
  c5 = c1 + c2;
  Serial.println(c5);
  c5 = c1 + 3;
  Serial.println(c5);
  c5 = c1 - c2;
  Serial.println(c5);
  c5 = c1 - 3;
  Serial.println(c5);


  Serial.println("\n5. * / ");
  c5 = c1 * c2;
  Serial.println(c5);
  c5 = c5 * 3;
  Serial.println(c5);
  c5 = c5 / c2;
  Serial.println(c5);
  c5 = c5 / 3;
  Serial.println(c5);

  c5 = c1 / c2 * c2;
  Serial.println(c5);
  c5 = c1 * c4 / c4;
  Serial.println(c5);


  Serial.println("\n6. assign += -= *= /=");
  c5 = c1;
  c5 += c1;
  Serial.println(c5);
  c5 += 3;
  Serial.println(c5);
  c5 -= c1;
  Serial.println(c5);
  c5 -= 3;
  Serial.println(c5);
  c5 *= c1;
  Serial.println(c5);
  c5 *= 3;
  Serial.println(c5);
  c5 /= c1;
  Serial.println(c5);
  c5 /= 3;
  Serial.println(c5);


  Serial.println("\n7. phase modulus polar");
  Serial.println(c1);
  double m = c1.modulus();
  Serial.println(m);
  double p = c1.phase();
  Serial.println(p);
  c5.polar(m, p);
  Serial.println(c5);


  Serial.println("\n8. conjugate reciprocal");
  c5 = c1.conjugate();
  Serial.println(c5);
  c5 = c5.conjugate();
  Serial.println(c5);
  c5 = c1.reciprocal();
  Serial.println(c5);
  c5 = c5.reciprocal();
  Serial.println(c5);

  Serial.println("\n9. power: exp log pow sqrt sqr logn log10");
  c5 = c1.c_sqr();
  Serial.println(c5);
  c5 = c1.c_exp();
  Serial.println(c5);
  c5 = c5.c_log();
  Serial.println(c5);
  c5 = c1.c_pow(2);
  Serial.println(c5);
  c5 = c5.c_sqrt();
  Serial.println(c5);
  c5 = c5.c_sqr();
  Serial.println(c5);
  c5 = c1.c_pow(c2);
  Serial.println(c5);
  c5 = c5.c_pow(c2.reciprocal());
  Serial.println(c5);
  c5 = c5.c_logn(c4);
  Serial.println(c5);
  c5 = c4.c_pow(c5);
  Serial.println(c5);
  c5 = c5.c_log10();
  Serial.println(c5);

  Serial.println("\n10. gonio: sin cos tan asin acos atan");
  c1.set(0.5, 0.5);
  c5 = c1.c_sin();
  Serial.println(c5);
  c5 = c5.c_asin();
  Serial.println(c5);
  c5 = c1.c_cos();
  Serial.println(c5);
  c5 = c5.c_acos();
  Serial.println(c5);
  c5 = c1.c_tan();
  Serial.println(c5);
  c5 = c5.c_atan();
  Serial.println(c5);

  Serial.println("\n11. gonio csc sec cot acsc asec acot");
  c1.set(0.5, 0.5);
  c5 = c1.c_csc();
  Serial.println(c5);
  c5 = c5.c_acsc();
  Serial.println(c5);
  c5 = c1.c_sec();
  Serial.println(c5);
  c5 = c5.c_asec();
  Serial.println(c5);
  c5 = c1.c_cot();
  Serial.println(c5);
  c5 = c5.c_acot();
  Serial.println(c5);

  Serial.println("\n12. gonio hyperbolicus I ");
  c1.set(0.5, 0.5);
  c5 = c1.c_sinh();
  Serial.println(c5);
  c5 = c5.c_asinh();
  Serial.println(c5);
  c5 = c1.c_cosh();
  Serial.println(c5);
  c5 = c5.c_acosh();
  Serial.println(c5);
  c5 = c1.c_tanh();
  Serial.println(c5);
  c5 = c5.c_atanh();
  Serial.println(c5);

  Serial.println("\n13. gonio hyperbolicus II ");
  c1.set(0.5, 0.5);
  c5 = c1.c_csch();
  Serial.println(c5);
  c5 = c5.c_acsch();
  Serial.println(c5);
  c5 = c1.c_sech();
  Serial.println(c5);
  c5 = c5.c_asech();
  Serial.println(c5);
  c5 = c1.c_coth();
  Serial.println(c5);
  c5 = c5.c_acoth();
  Serial.println(c5);

  Serial.println("\n.. Complex done");

  uint32_t start = micros();
  for (int i=0; i<1000; i++)
  {
    c5 = c5.c_csc();
  }
  uint32_t dur = micros() - start;
  Serial.println(dur);
  Serial.println(one);
}

void loop()
{
}
//
// END OF FILE
//
/*  OUTPUT:
 *   
 Complex numbers test for Arduino: 0.1.09

1. Print Complex, set, real, imag
1.000 0.000i
10.000 -2.000i
3.000 0.000i
-10.000 4.000i
-5.000 -5.000i
0.000 0.000i
0.00
0.00

2. ==  !=
ok :)
ok :)
ok :)

3. negation -
-10.000 2.000i
10.000 -2.000i
ok :)

4. + -
13.000 -2.000i
13.000 -2.000i
7.000 -2.000i
7.000 -2.000i

5. * /
30.000 -6.000i
90.000 -18.000i
30.000 -6.000i
10.000 -2.000i
10.000 -2.000i
10.000 -2.000i

6. assign += -= *= /=
20.000 -4.000i
23.000 -4.000i
13.000 -2.000i
10.000 -2.000i
96.000 -40.000i
288.000 -120.000i
30.000 -6.000i
10.000 -2.000i

7. phase modulus polar
10.000 -2.000i
10.20
-0.20
10.000 -2.000i

8. conjugate reciprocal
10.000 2.000i
10.000 -2.000i
0.096 0.019i
10.000 -2.000i

9. power: exp log pow sqrt sqr logn log10
96.000 -40.000i
-9166.244 -20028.609i
10.000 -2.000i
96.000 -40.000i
10.000 -2.000i
96.000 -40.000i
880.000 -592.000i
10.000 -2.000i
0.534 0.542i
10.000 -2.000i
1.009 -0.086i

10. gonio: sin cos tan asin acos atan
0.541 0.457i
0.500 0.500i
0.990 -0.250i
0.500 0.500i
0.404 0.564i
0.500 0.500i

11. gonio csc sec cot acsc asec acot
1.078 -0.912i
0.500 0.500i
0.950 0.240i
0.500 0.500i
0.839 -1.172i
0.500 0.500i

12. gonio hyperbolicus I
0.457 0.541i
0.500 0.500i
0.990 0.250i
0.500 0.500i
0.564 0.404i
0.500 0.500i

13. gonio hyperbolicus II
0.912 -1.078i
0.500 0.500i
0.950 -0.240i
0.500 0.500i
1.172 -0.839i
0.500 0.500i

.. Complex done
116805
1.000 0.000i
 
 
 */



and Inside the IDE window, click in the upper right Arrow to open a folder Inside this window that you call Complex.h   . Copy and paste Complex.h from the original library inside Complex.h.

Click again in the upper right Arrow and add a new folder Inside Complex.ino that you call Complex.cpp  . Copy and paste Complex.cpp from the original Library Inside Complex.cpp

Then compile, upload and run  Complex.ino on your DUE.

I did a copy of the results at the end of Complex.ino above.
In the following link you will find the complex library that works on Arduino DUE, just read the ReleaseNote.txt. Your post @ard_newbie was very helpful to find this compilation mistake.

https://github.com/RobTillaart/Arduino/tree/master/libraries/Complex

jlsilicon

#145
Jan 28, 2018, 12:27 am Last Edit: Jan 29, 2018, 04:22 am by jlsilicon
I noticed that the SERVO and IRREMOTE Librares were mentione earlier here in the Timers Forum for the Arduino DUE.

Has anybody solved the problem with the Conflict with Timer3 between the Servo and IRRemote Libs ?

- I attempted to, but was not successful.

Anybody have a Solution ?

jdelcamp11

I have a library for the adafruit VC0706 camera.
The issue was the Due does not support soft serial. So I simply remove any reference to soft serial.
This may be the problem with many of the compatability issues.
I know there is a better way to do this, using "if architecture SAM3X". But this worked for me.

zahraali079

i included 2 libraries of  arduino due using (plc + schduler ) plc lib all functions was working properly but when adding shduler library the code complied normally but when i go to see result only first loop that fundtion in board due and stoped other loops don't work

nitrof

#148
Apr 09, 2018, 01:48 am Last Edit: Apr 09, 2018, 01:49 am by nitrof
Hi zahraali079.

First, to reach more people to help you, you should start a new tread.

Second, provide your code.

Regards. Nitrof

Go Up