I’m converting all my Arduino projects to PlatformIO. I like the interfaces and it’s very easy to add projects with different libraries. Thanks for that.
No I have a question. I need to exclude the “Arduino.h” library to deactivate the HardwareSerial.h library. I wanna add a Softserial library. Here is the code in the Main.ino:
#ifndef FastSerial_h
#define FastSerial_h
// disable the stock Arduino serial driver
#ifdef HardwareSerial_h
# error Must include FastSerial.h before the Arduino serial driver is defined.
#endif
#define HardwareSerial_h
Now PlatformIO ignore the second include of “Arduino.h”. So the Arduino library is in use before I can include the “FastSerial.h”. That’s my problem at the moment. Is there a way to change the order:
First: FastSerial.h / Second: Arduino.h
Hi, with Arduino IDE 1.0.5 and before it worked with this code inside the library FastSerial.h:
#ifndef FastSerial_h
#define FastSerial_h
// disable the stock Arduino serial driver
#ifdef HardwareSerial_h
# error Must include FastSerial.h before the Arduino serial driver is defined.
#endif
#define HardwareSerial_h
Since version 1.6.0 I added this code into the main.ino (to make it work):
Hi and sorry for the very late reply. I tried different LDF options… no solution.
I also tested: build_flags = -exclude HardwareSerial.h build_flags = -L/home/fabian/lib -lFastSerial
Still the same error. I hope you have another trick.
UPDATE:
This option: build_flags = -include /home/fabian/lib/FastSerial/FastSerial.h'
Returns this error: ArduLED.ino:459:23: error: cannot convert 'HardwareSerial*' to 'BetterStream*' in assignment
Seems that the original HardwareSerial make problems. HardwareSerial.h:143:25: note: previous declaration as 'HardwareSerial Serial' extern HardwareSerial Serial;