New to Arduino. Stuck at at errors in code, unable to compile.

Hi there, I am a recent newcomer to Arduino but have learned a few things since getting started. I've played around with the blinky sketch, a fading LED sketch and a few other simple sketches with success. I've successfully compiled a few things on my own. I recently built a device called an HK (Harman Kardon) Enabler using a Pro Micro board and some other items to replace the radio in my Mini Cooper. The device hooks to the I/K-Bus in the vehicle and sends out serial commands to fool the car into thinking the factory radio is still attached and turns on the HK amplifier so it can be used by an aftermarket radio.

The hardware build went well, I can connect to the device using the Online Editor, Leonardo on COM5 and upload simple sketches successfully. But the Code used to run the enabler has a problem and I cant seem to make sense of the error or get it to compile. The author has long since abandoned the project and Google has not been much help as I don't understand the nature of the error. I was hoping someone could guide me in the right direction please.

I'm attaching the HK Enabler code in a .zip file if needed, a photo of the device and and circuitboard. Also posting the error using the code tags.

./opt/arduino-builder/arduino-builder -compile -core-api-version 10611 -build-path /tmp/989312102/build -hardware opt/arduino-builder/hardware -hardware ./opt/cores -tools opt/arduino-builder/tools -tools ./opt/tools -built-in-libraries opt/libraries/latest -libraries /tmp/989312102/pinned -libraries /tmp/989312102/custom -fqbn arduino:avr:leonardo -build-cache /tmp -logger humantags -verbose=true /tmp/989312102/HK_Enabler_Final
Using board 'leonardo' from platform in folder: /home/ubuntu/opt/cores/arduino/avr
Using core 'arduino' from platform in folder: /home/ubuntu/opt/cores/arduino/avr
Detecting libraries used...
"/home/ubuntu/opt/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_AVR -DUSB_VID=0x2341 -DUSB_PID=0x8036 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Leonardo"' "-I/home/ubuntu/opt/cores/arduino/avr/cores/arduino" "-I/home/ubuntu/opt/cores/arduino/avr/variants/leonardo" "/tmp/989312102/build/sketch/HK_Enabler_Final.ino.cpp" -o "/dev/null"
Generating function prototypes...
"/home/ubuntu/opt/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_AVR -DUSB_VID=0x2341 -DUSB_PID=0x8036 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Leonardo"' "-I/home/ubuntu/opt/cores/arduino/avr/cores/arduino" "-I/home/ubuntu/opt/cores/arduino/avr/variants/leonardo" "/tmp/989312102/build/sketch/HK_Enabler_Final.ino.cpp" -o "/tmp/989312102/build/preproc/ctags_target_for_gcc_minus_e.cpp"
"/home/ubuntu/opt/arduino-builder/tools/arduino-preprocessor/0.1.5/arduino-preprocessor" "/tmp/989312102/build/preproc/ctags_target_for_gcc_minus_e.cpp" "" -- -std=gnu++11
Compiling sketch...
"/home/ubuntu/opt/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_AVR -DUSB_VID=0x2341 -DUSB_PID=0x8036 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Leonardo"' "-I/home/ubuntu/opt/cores/arduino/avr/cores/arduino" "-I/home/ubuntu/opt/cores/arduino/avr/variants/leonardo" "/tmp/989312102/build/sketch/HK_Enabler_Final.ino.cpp" -o "/tmp/989312102/build/sketch/HK_Enabler_Final.ino.cpp.o"
/tmp/989312102/HK_Enabler_Final/HK_Enabler_Final.ino: In function 'boolean process_incoming_data()':
/tmp/989312102/HK_Enabler_Final/HK_Enabler_Final.ino:121:42: error: no matching function for call to 'HardwareSerial::peek(int)'
if (bytes_availble && (Serial1.peek(PKT_SRC) != DSP_ADDR) && (Serial1.peek(PKT_SRC) != SW_ADDR)) { 
^
/tmp/989312102/HK_Enabler_Final/HK_Enabler_Final.ino:121:42: note: candidate is:
In file included from /home/ubuntu/opt/cores/arduino/avr/cores/arduino/Arduino.h:232:0,
from /tmp/989312102/build/sketch/HK_Enabler_Final.ino.cpp:1:
/home/ubuntu/opt/cores/arduino/avr/cores/arduino/HardwareSerial.h:125:17: note: virtual int HardwareSerial::peek()
virtual int peek(void);
^
/home/ubuntu/opt/cores/arduino/avr/cores/arduino/HardwareSerial.h:125:17: note: candidate expects 0 arguments, 1 provided
/tmp/989312102/HK_Enabler_Final/HK_Enabler_Final.ino:121:71: error: no matching function for call to 'HardwareSerial::peek(int)'
if (bytes_availble && (Serial1.peek(PKT_SRC) != DSP_ADDR) && (Serial1.peek(PKT_SRC) != SW_ADDR)) { 
^
/tmp/989312102/HK_Enabler_Final/HK_Enabler_Final.ino:121:71: note: candidate is:
In file included from /home/ubuntu/opt/cores/arduino/avr/cores/arduino/Arduino.h:232:0,
from /tmp/989312102/build/sketch/HK_Enabler_Final.ino.cpp:1:
/home/ubuntu/opt/cores/arduino/avr/cores/arduino/HardwareSerial.h:125:17: note: virtual int HardwareSerial::peek()
virtual int peek(void);
^
/home/ubuntu/opt/cores/arduino/avr/cores/arduino/HardwareSerial.h:125:17: note: candidate expects 0 arguments, 1 provided
/tmp/989312102/HK_Enabler_Final/HK_Enabler_Final.ino:123:17: error: 'class HardwareSerial' has no member named 'remove'
Serial1.remove(1); 
^
/tmp/989312102/HK_Enabler_Final/HK_Enabler_Final.ino:128:42: error: no matching function for call to 'HardwareSerial::peek(int)'
uint8_t data_len = Serial1.peek(PKT_LEN); 
^
/tmp/989312102/HK_Enabler_Final/HK_Enabler_Final.ino:128:42: note: candidate is:
In file included from /home/ubuntu/opt/cores/arduino/avr/cores/arduino/Arduino.h:232:0,
from /tmp/989312102/build/sketch/HK_Enabler_Final.ino.cpp:1:
/home/ubuntu/opt/cores/arduino/avr/cores/arduino/HardwareSerial.h:125:17: note: virtual int HardwareSerial::peek()
virtual int peek(void);
^
/home/ubuntu/opt/cores/arduino/avr/cores/arduino/HardwareSerial.h:125:17: note: candidate expects 0 arguments, 1 provided
/tmp/989312102/HK_Enabler_Final/HK_Enabler_Final.ino:135:21: error: 'class HardwareSerial' has no member named 'remove'
Serial1.remove(1); 
^
/tmp/989312102/HK_Enabler_Final/HK_Enabler_Final.ino:153:56: error: no matching function for call to 'HardwareSerial::peek(int&)'
calculated_chksum ^= Serial1.peek(i); 
^
/tmp/989312102/HK_Enabler_Final/HK_Enabler_Final.ino:153:56: note: candidate is:
In file included from /home/ubuntu/opt/cores/arduino/avr/cores/arduino/Arduino.h:232:0,
from /tmp/989312102/build/sketch/HK_Enabler_Final.ino.cpp:1:
/home/ubuntu/opt/cores/arduino/avr/cores/arduino/HardwareSerial.h:125:17: note: virtual int HardwareSerial::peek()
virtual int peek(void);
^
/home/ubuntu/opt/cores/arduino/avr/cores/arduino/HardwareSerial.h:125:17: note: candidate expects 0 arguments, 1 provided
/tmp/989312102/HK_Enabler_Final/HK_Enabler_Final.ino:156:65: error: no matching function for call to 'HardwareSerial::peek(uint8_t&)'
if (calculated_chksum == Serial1.peek(chksum_ind)) { 
^
/tmp/989312102/HK_Enabler_Final/HK_Enabler_Final.ino:156:65: note: candidate is:
In file included from /home/ubuntu/opt/cores/arduino/avr/cores/arduino/Arduino.h:232:0,
from /tmp/989312102/build/sketch/HK_Enabler_Final.ino.cpp:1:
/home/ubuntu/opt/cores/arduino/avr/cores/arduino/HardwareSerial.h:125:17: note: virtual int HardwareSerial::peek()
virtual int peek(void);
^
/home/ubuntu/opt/cores/arduino/avr/cores/arduino/HardwareSerial.h:125:17: note: candidate expects 0 arguments, 1 provided
/tmp/989312102/HK_Enabler_Final/HK_Enabler_Final.ino:171:29: error: 'class HardwareSerial' has no member named 'remove'
Serial1.remove(1); 
^
/tmp/989312102/HK_Enabler_Final/HK_Enabler_Final.ino:185:29: error: 'class HardwareSerial' has no member named 'remove'
Serial1.remove(1); 
^
exit status 1

I am only seeing Line #121 highlighted orange in the code (no matching function for call to 'HardwareSerial::peek(int))', but there seems to be multiple lines of errors listed in the bottom pane of the online editor. Are they all related to a single line in the code? #121?

HK_Enabler_Final.zip (22.1 KB)

It's saying that Serial1.peek() is a 0 argument function so you can't have anything inside the ().

Also the remove() function does not exist.

Ok thank you, this is looking better.

./opt/arduino-builder/arduino-builder -compile -core-api-version 10611 -build-path /tmp/639880966/build -hardware opt/arduino-builder/hardware -hardware ./opt/cores -tools opt/arduino-builder/tools -tools ./opt/tools -built-in-libraries opt/libraries/latest -libraries /tmp/639880966/pinned -libraries /tmp/639880966/custom -fqbn arduino:avr:leonardo -build-cache /tmp -logger humantags -verbose=true /tmp/639880966/HK_Enabler_Final
Using board 'leonardo' from platform in folder: /home/ubuntu/opt/cores/arduino/avr
Using core 'arduino' from platform in folder: /home/ubuntu/opt/cores/arduino/avr
Detecting libraries used...
"/home/ubuntu/opt/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_AVR -DUSB_VID=0x2341 -DUSB_PID=0x8036 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Leonardo"' "-I/home/ubuntu/opt/cores/arduino/avr/cores/arduino" "-I/home/ubuntu/opt/cores/arduino/avr/variants/leonardo" "/tmp/639880966/build/sketch/HK_Enabler_Final.ino.cpp" -o "/dev/null"
Generating function prototypes...
"/home/ubuntu/opt/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_AVR -DUSB_VID=0x2341 -DUSB_PID=0x8036 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Leonardo"' "-I/home/ubuntu/opt/cores/arduino/avr/cores/arduino" "-I/home/ubuntu/opt/cores/arduino/avr/variants/leonardo" "/tmp/639880966/build/sketch/HK_Enabler_Final.ino.cpp" -o "/tmp/639880966/build/preproc/ctags_target_for_gcc_minus_e.cpp"
"/home/ubuntu/opt/arduino-builder/tools/arduino-preprocessor/0.1.5/arduino-preprocessor" "/tmp/639880966/build/preproc/ctags_target_for_gcc_minus_e.cpp" "" -- -std=gnu++11
Compiling sketch...
"/home/ubuntu/opt/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_AVR -DUSB_VID=0x2341 -DUSB_PID=0x8036 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Leonardo"' "-I/home/ubuntu/opt/cores/arduino/avr/cores/arduino" "-I/home/ubuntu/opt/cores/arduino/avr/variants/leonardo" "/tmp/639880966/build/sketch/HK_Enabler_Final.ino.cpp" -o "/tmp/639880966/build/sketch/HK_Enabler_Final.ino.cpp.o"
/tmp/639880966/HK_Enabler_Final/HK_Enabler_Final.ino: In function 'boolean process_incoming_data()':
/tmp/639880966/HK_Enabler_Final/HK_Enabler_Final.ino:123:17: error: 'class HardwareSerial' has no member named 'remove'
Serial1.remove(1); 
^
/tmp/639880966/HK_Enabler_Final/HK_Enabler_Final.ino:135:21: error: 'class HardwareSerial' has no member named 'remove'
Serial1.remove(1); 
^
/tmp/639880966/HK_Enabler_Final/HK_Enabler_Final.ino:171:29: error: 'class HardwareSerial' has no member named 'remove'
Serial1.remove(1); 
^
/tmp/639880966/HK_Enabler_Final/HK_Enabler_Final.ino:185:29: error: 'class HardwareSerial' has no member named 'remove'
Serial1.remove(1); 
^
exit status 1

You're right, remove() is not listed in the reference under serial. So what is Serial1.remove(1) in the code trying to accomplish and what can I replace it with?

It looks like Serial1.remove(1) just removes the next character from the Serial1 input buffer. If so, you can just read that byte and throw it away. Replace "Serial1.remove(1)" with "Serial1.read()".

Pete