digistump / DigistumpArduino

Files to add Digistump support (Digispark, Pro, DigiX) to Arduino 1.6.X (1.6.5+)
932 stars 377 forks source link

Unable to Find #Include SoftwareSerial.h library #128

Closed djayor closed 4 years ago

djayor commented 4 years ago

Environment: macOS 10.15.6; Arduino IDE 1.8.12; Digistump AVR Boards v1.6.7 Board: Digispark (Default - 16.5mhz) - Programmer: micronucleus

Hi, when I'm trying to compile the example: DigisparkSoftSerial - TwoPortReceive, I receive a error:

/Users/melo/Library/Arduino15/packages/arduino/tools/avr-gcc/4.8.1-arduino5/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -MMD -mmcu=attiny85 -DF_CPU=16500000L -DARDUINO=10812 -DARDUINO_AVR_DIGISPARK -DARDUINO_ARCH_AVR -I/Users/melo/Library/Arduino15/packages/digistump/hardware/avr/1.6.7/cores/tiny -I/Users/melo/Library/Arduino15/packages/digistump/hardware/avr/1.6.7/variants/digispark -I/Users/melo/Library/Arduino15/packages/digistump/hardware/avr/1.6.7/libraries/DigisparkSoftSerial -I/Users/melo/Library/Arduino15/packages/digistump/hardware/avr/1.6.7/libraries/DigisparkTinyPinChange /var/folders/tm/k68l_3wn5p18wh624ky_rzpc0000gn/T/arduino_build_778343/sketch/TwoPortReceive.ino.cpp -o /var/folders/tm/k68l_3wn5p18wh624ky_rzpc0000gn/T/arduino_build_778343/sketch/TwoPortReceive.ino.cpp.o
/var/folders/tm/k68l_3wn5p18wh624ky_rzpc0000gn/T/arduino_modified_sketch_842404/TwoPortReceive.ino: In function 'void setup()':
TwoPortReceive:41:11: error: no match for 'operator!' (operand type is 'TinyDebugSerial')
    while (!Serial) {
           ^~~~~~~
/var/folders/tm/k68l_3wn5p18wh624ky_rzpc0000gn/T/arduino_modified_sketch_842404/TwoPortReceive.ino:41:11: note: candidate: operator!(bool) <built-in>
/var/folders/tm/k68l_3wn5p18wh624ky_rzpc0000gn/T/arduino_modified_sketch_842404/TwoPortReceive.ino:41:11: note:   no known conversion for argument 1 from 'TinyDebugSerial' to 'bool'
Using library DigisparkSoftSerial in folder: /Users/melo/Library/Arduino15/packages/digistump/hardware/avr/1.6.7/libraries/DigisparkSoftSerial (legacy)
Using library DigisparkTinyPinChange in folder: /Users/melo/Library/Arduino15/packages/digistump/hardware/avr/1.6.7/libraries/DigisparkTinyPinChange (legacy)
exit status 1
no match for 'operator!' (operand type is 'TinyDebugSerial')

The only way to compile is removing the lines:

  Serial.begin(9600);
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
ArminJo commented 4 years ago

Try https://github.com/ArminJo/DigistumpArduino.

djayor commented 4 years ago

Well it work anyway without the lines that I remove. But now I have another problem, when I add "DigiKeyboard.h" library in the same program that have:

include

OR

include

I get errors. If I compile this individual libraries isolated (different programs and folders) I can compile.

Error while detecting libraries included by /Users/melo/Library/Arduino15/packages/digistump/hardware/avr/1.6.7/libraries/DigisparkKeyboard/usbdrvasm.S
/var/folders/tm/k68l_3wn5p18wh624ky_rzpc0000gn/T/arduino_build_906347/libraries/DigisparkKeyboard/usbdrvasm.S.o: In function `__vector_2':
/Users/melo/Library/Arduino15/packages/digistump/hardware/avr/1.6.7/libraries/DigisparkKeyboard/usbdrvasm165.inc:41: multiple definition of `__vector_2'
/var/folders/tm/k68l_3wn5p18wh624ky_rzpc0000gn/T/arduino_build_906347/libraries/DigisparkTinyPinChange/TinyPinChange.cpp.o:/Users/melo/Library/Arduino15/packages/digistump/hardware/avr/1.6.7/libraries/DigisparkTinyPinChange/TinyPinChange.cpp:57: first defined here
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Digispark (Default - 16.5mhz).
ArminJo commented 4 years ago

You know what multiple definition of__vector_2'` means?

djayor commented 4 years ago

I don't know, but if I just add these 3 libraries to the program, I get that error. I believe that one of the variables mentioned in this libraries is repeated.

ArminJo commented 4 years ago

In short vector2 is for Pin Change Interrupt Request 0. So multiple libraries try to use the same hardware resource the vector2. This is a common problem with libraries using limited hardware resources and cannot be solved.

djayor commented 4 years ago

Oh thanks, this makes sense. I solve the problem using this library, instead of "SoftSerial.h": https://github.com/J-Rios/Digispark_SoftSerial-INT0 And instead of "DigiKeyboard.h" I used: https://github.com/adafruit/Adafruit-Trinket-USB/tree/master/TrinketHidCombo

Works fine this way.