yoelk / instrumentino

Instrumentino is an open-source modular graphical user interface framework for controlling Arduino based experimental instruments
GNU General Public License v3.0
137 stars 59 forks source link

HardwareSerial conflicting declaration #42

Open josepmsa opened 7 years ago

josepmsa commented 7 years ago

Hi! I am trying to compile controlino for an Arduino Due board, but I am getting the following error messages: controlino:97: error: conflicting declaration 'HardwareSerial Serial1' extern HardwareSerial Serial1; ^ In file included from /home/jsanchez/.arduino15/packages/arduino/hardware/sam/1.6.8/cores/arduino/Arduino.h:201:0, from /home/jsanchez/instrumentino-master/controlino/controlino/controlino.ino:70: /home/jsanchez/.arduino15/packages/arduino/hardware/sam/1.6.8/variants/arduino_due_x/variant.h:247:19: error: 'Serial1' has a previous declaration as 'USARTClass Serial1' extern USARTClass Serial1; ^ controlino:98: error: conflicting declaration 'HardwareSerial Serial2' extern HardwareSerial Serial2; ^ In file included from /home/jsanchez/.arduino15/packages/arduino/hardware/sam/1.6.8/cores/arduino/Arduino.h:201:0, from /home/jsanchez/instrumentino-master/controlino/controlino/controlino.ino:70: /home/jsanchez/.arduino15/packages/arduino/hardware/sam/1.6.8/variants/arduino_due_x/variant.h:248:19: error: 'Serial2' has a previous declaration as 'USARTClass Serial2' extern USARTClass Serial2; ^ controlino:99: error: conflicting declaration 'HardwareSerial Serial3' extern HardwareSerial Serial3; ^ In file included from /home/jsanchez/.arduino15/packages/arduino/hardware/sam/1.6.8/cores/arduino/Arduino.h:201:0, from /home/jsanchez/instrumentino-master/controlino/controlino/controlino.ino:70: /home/jsanchez/.arduino15/packages/arduino/hardware/sam/1.6.8/variants/arduino_due_x/variant.h:249:19: error: 'Serial3' has a previous declaration as 'USARTClass Serial3' extern USARTClass Serial3; ^ controlino:258: error: conflicting declaration 'HardwareSerial Serial' extern HardwareSerial Serial; ^ In file included from /home/jsanchez/.arduino15/packages/arduino/hardware/sam/1.6.8/cores/arduino/Arduino.h:201:0, from /home/jsanchez/instrumentino-master/controlino/controlino/controlino.ino:70: /home/jsanchez/.arduino15/packages/arduino/hardware/sam/1.6.8/variants/arduino_due_x/variant.h:246:18: error: 'Serial' has a previous declaration as 'UARTClass Serial' extern UARTClass Serial; ^ exit status 1 conflicting declaration 'HardwareSerial Serial1'

However, for an Arduino Uno it just works fine and it compiles correctly. Googling the problem I found this github thread. In the last comment they mention that those device specific flags may be the origin of the problem, but I don't know if that is applicable to your code.

Have you ever had this issue before?

Thank you in advanced! JosepM

yoelk commented 7 years ago

HI JosepM, I didn't see a solution to the problem in the thread you mentioned. Did you? I'm sorry but I never used a Due before so I'm unfamiliar with this problem. But I guess whatever solution you find, you can apply it to the controlino sketch as well. If you do, please consider making a pull-request with the changes you made.

And btw, please have a look at the develop-v2 thread on Github. I started implementing a second much-better version of Instrumentino and I'd be really happy if other interested people would like to join me in its development.

Thanks, Joel

On Wed, Feb 1, 2017 at 2:33 PM, josepmsa notifications@github.com wrote:

Hi! I am trying to compile controlino for an Arduino Due board, but I am getting the following error messages: controlino:97: error: conflicting declaration 'HardwareSerial Serial1' extern HardwareSerial Serial1; ^ In file included from /home/jsanchez/.arduino15/packages/arduino/hardware/sam/ 1.6.8/cores/arduino/Arduino.h:201:0, from /home/jsanchez/instrumentino- master/controlino/controlino/controlino.ino:70: /home/jsanchez/.arduino15/ packages/arduino/hardware/sam/1.6.8/variants/arduino_due_x/variant.h:247:19: error: 'Serial1' has a previous declaration as 'USARTClass Serial1' extern USARTClass Serial1; ^ controlino:98: error: conflicting declaration 'HardwareSerial Serial2' extern HardwareSerial Serial2; ^ In file included from /home/jsanchez/.arduino15/packages/arduino/hardware/sam/ 1.6.8/cores/arduino/Arduino.h:201:0, from /home/jsanchez/instrumentino- master/controlino/controlino/controlino.ino:70: /home/jsanchez/.arduino15/ packages/arduino/hardware/sam/1.6.8/variants/arduino_due_x/variant.h:248:19: error: 'Serial2' has a previous declaration as 'USARTClass Serial2' extern USARTClass Serial2; ^ controlino:99: error: conflicting declaration 'HardwareSerial Serial3' extern HardwareSerial Serial3; ^ In file included from /home/jsanchez/.arduino15/packages/arduino/hardware/sam/ 1.6.8/cores/arduino/Arduino.h:201:0, from /home/jsanchez/instrumentino- master/controlino/controlino/controlino.ino:70: /home/jsanchez/.arduino15/ packages/arduino/hardware/sam/1.6.8/variants/arduino_due_x/variant.h:249:19: error: 'Serial3' has a previous declaration as 'USARTClass Serial3' extern USARTClass Serial3; ^ controlino:258: error: conflicting declaration 'HardwareSerial Serial' extern HardwareSerial Serial; ^ In file included from /home/jsanchez/.arduino15/packages/arduino/hardware/sam/ 1.6.8/cores/arduino/Arduino.h:201:0, from /home/jsanchez/instrumentino- master/controlino/controlino/controlino.ino:70: /home/jsanchez/.arduino15/ packages/arduino/hardware/sam/1.6.8/variants/arduino_due_x/variant.h:246:18: error: 'Serial' has a previous declaration as 'UARTClass Serial' extern UARTClass Serial; ^ exit status 1 conflicting declaration 'HardwareSerial Serial1'

However, for an Arduino Uno it just works fine and it compiles correctly. Googling the problem I found this github thread https://github.com/mrstig/arduino-netbeans/issues/6. In the last comment they mention that those device specific flags may be the origin of the problem, but I don't know if that is applicable to your code.

Have you ever had this issue before?

Thank you in advanced! JosepM

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/yoelk/instrumentino/issues/42, or mute the thread https://github.com/notifications/unsubscribe-auth/AGTaGwwmEwAPT8dfQsfESJkT8TGGCEcJks5rYIm4gaJpZM4Lz3ht .

pescadoranton commented 7 years ago

Hello,

I have also used instrumentino with the arduino due and I had to make some changes. I have replaced these commands on Controlino:

extern HardwareSerial Serial; by extern UARTClass Serial;

and

extern HardwareSerial Serial1; extern HardwareSerial Serial2; extern HardwareSerial Serial3; by extern USARTClass Serial1;
extern USARTClass Serial2;
extern USARTClass Serial3;

On the other hand in order to use SPI comunication. I have replaced:

SPI.transfer(strtol(argV[i], NULL, 10)); by SPI.transfer(cs_pin, strtol(argV[i], NULL, 10));

Best regards, pescadoranton