Go Down

Topic: Complex number printing (Read 751 times) previous topic - next topic


How can I do a Serial.println() for an array variable which has been delared as a complex number?

the code below provides me with the following errors

sketch_oct05a.ino: In function 'void loop()':
sketch_oct05a:22: error: no matching function for call to 'UARTClass::println(complex&)'
C:\arduino-1.5.2\arduino-1.5.2\hardware\arduino\sam\cores\arduino/Print.h:67: note: candidates are: size_t Print::println(const __FlashStringHelper*)
C:\arduino-1.5.2\arduino-1.5.2\hardware\arduino\sam\cores\arduino/Print.h:68: note:                 size_t Print::println(const String&)
C:\arduino-1.5.2\arduino-1.5.2\hardware\arduino\sam\cores\arduino/Print.h:69: note:                 size_t Print::println(const char*)
C:\arduino-1.5.2\arduino-1.5.2\hardware\arduino\sam\cores\arduino/Print.h:70: note:                 size_t Print::println(char)
C:\arduino-1.5.2\arduino-1.5.2\hardware\arduino\sam\cores\arduino/Print.h:71: note:                 size_t Print::println(unsigned char, int)
C:\arduino-1.5.2\arduino-1.5.2\hardware\arduino\sam\cores\arduino/Print.h:72: note:                 size_t Print::println(int, int)
C:\arduino-1.5.2\arduino-1.5.2\hardware\arduino\sam\cores\arduino/Print.h:73: note:                 size_t Print::println(unsigned int, int)
C:\arduino-1.5.2\arduino-1.5.2\hardware\arduino\sam\cores\arduino/Print.h:74: note:                 size_t Print::println(long int, int)
C:\arduino-1.5.2\arduino-1.5.2\hardware\arduino\sam\cores\arduino/Print.h:75: note:                 size_t Print::println(long unsigned int, int)
C:\arduino-1.5.2\arduino-1.5.2\hardware\arduino\sam\cores\arduino/Print.h:76: note:                 size_t Print::println(double, int)
C:\arduino-1.5.2\arduino-1.5.2\hardware\arduino\sam\cores\arduino/Print.h:77: note:                 size_t Print::println(const Printable&)
C:\arduino-1.5.2\arduino-1.5.2\hardware\arduino\sam\cores\arduino/Print.h:78: note:                 size_t Print::println()

Code: [Select]

//   Include FFT header
#include "librowfft.h"
#include <stdio.h>
#include <complex.h>

complex *pSignal = new complex[1024];
int Mysignal;

void setup() {

void loop() {
  for (int i=0;i<1024;i++){
  CFFT::Forward(pSignal, 1024);
for (int p=0;p<1024;p++){



How can I do a Serial.println() for an array variable which has been delared as a complex number?

What is a complex? A link to the library is needed.


Code: [Select]
complex *pSignal = new complex[1024];
int Mysignal;

That's a lot of RAM - what are you running this on?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.


It is probably not included for space reasons. You will have to roll your own. Like AWOL hinted at, if you are going to do lots of complex arithmetic, you probably need to rethink your processor approach.


FYI my complex lib supports Serial.println()

see - https://github.com/RobTillaart/Arduino/tree/master/libraries/Complex - for the last version.

You can use it as an example how to build print support into your complex lib too.

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Go Up