Compile Function Issue...Tried Gammon Fix

Original code was for two motion sensors controlling one light via a switch. It works, on a duemilanove on the bench.

New code for two light systems, inside and outside with 6 motion sensors (2 in, 4 out) has function compilation issues as below.

Copied and pasted to expand, changed the names to effect a separate light control system sharing a CDS sensor. I can’s see the issue.

Tried Nick’s “blank file” technique with “#include <Arduino.h>” in the blank, and a new tab with all the code named “motion.cpp”. The errors were compounded with Serial not recognized, A0 not recognized etc. Reverted to original and posted below. IDE 1.8.2

Any help would be appreciated! TIA


Verbose Errors:

Arduino: 1.8.0 (Linux), Board: "Arduino Duemilanove or Diecimila, ATmega328P"

/home/dave/arduino-1.8.0/arduino-builder -dump-prefs -logger=machine -hardware /home/dave/arduino-1.8.0/hardware -hardware /home/dave/.arduino15/packages -tools /home/dave/arduino-1.8.0/tools-builder -tools /home/dave/arduino-1.8.0/hardware/tools/avr -tools /home/dave/.arduino15/packages -built-in-libraries /home/dave/arduino-1.8.0/libraries -libraries /home/dave/Arduino/libraries -fqbn=arduino:avr:diecimila:cpu=atmega328 -ide-version=10800 -build-path /tmp/arduino_build_377289 -warnings=all -prefs=build.warn_data_percentage=75 -verbose /home/dave/Arduino/_6MotionSwitch/_6MotionSwitch.ino
/home/dave/arduino-1.8.0/arduino-builder -compile -logger=machine -hardware /home/dave/arduino-1.8.0/hardware -hardware /home/dave/.arduino15/packages -tools /home/dave/arduino-1.8.0/tools-builder -tools /home/dave/arduino-1.8.0/hardware/tools/avr -tools /home/dave/.arduino15/packages -built-in-libraries /home/dave/arduino-1.8.0/libraries -libraries /home/dave/Arduino/libraries -fqbn=arduino:avr:diecimila:cpu=atmega328 -ide-version=10800 -build-path /tmp/arduino_build_377289 -warnings=all -prefs=build.warn_data_percentage=75 -verbose /home/dave/Arduino/_6MotionSwitch/_6MotionSwitch.ino
Using board 'diecimila' from platform in folder: /home/dave/.arduino15/packages/arduino/hardware/avr/1.6.20
Using core 'arduino' from platform in folder: /home/dave/.arduino15/packages/arduino/hardware/avr/1.6.20
Detecting libraries used...
"/home/dave/.arduino15/packages/arduino/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  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10800 -DARDUINO_AVR_DUEMILANOVE -DARDUINO_ARCH_AVR   "-I/home/dave/.arduino15/packages/arduino/hardware/avr/1.6.20/cores/arduino" "-I/home/dave/.arduino15/packages/arduino/hardware/avr/1.6.20/variants/standard" "/tmp/arduino_build_377289/sketch/_6MotionSwitch.ino.cpp" -o "/dev/null"
Generating function prototypes...
"/home/dave/.arduino15/packages/arduino/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  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10800 -DARDUINO_AVR_DUEMILANOVE -DARDUINO_ARCH_AVR   "-I/home/dave/.arduino15/packages/arduino/hardware/avr/1.6.20/cores/arduino" "-I/home/dave/.arduino15/packages/arduino/hardware/avr/1.6.20/variants/standard" "/tmp/arduino_build_377289/sketch/_6MotionSwitch.ino.cpp" -o "/tmp/arduino_build_377289/preproc/ctags_target_for_gcc_minus_e.cpp"
"/home/dave/arduino-1.8.0/tools-builder/ctags/5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "/tmp/arduino_build_377289/preproc/ctags_target_for_gcc_minus_e.cpp"
Compiling sketch...
"/home/dave/.arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10800 -DARDUINO_AVR_DUEMILANOVE -DARDUINO_ARCH_AVR   "-I/home/dave/.arduino15/packages/arduino/hardware/avr/1.6.20/cores/arduino" "-I/home/dave/.arduino15/packages/arduino/hardware/avr/1.6.20/variants/standard" "/tmp/arduino_build_377289/sketch/_6MotionSwitch.ino.cpp" -o "/tmp/arduino_build_377289/sketch/_6MotionSwitch.ino.cpp.o"
/home/dave/Arduino/_6MotionSwitch/_6MotionSwitch.ino: In function 'void loop()':
_6MotionSwitch:108: error: 'lightsOutON' was not declared in this scope
     lightsOutON();  //ON position is always on.
/home/dave/Arduino/_6MotionSwitch/_6MotionSwitch.ino: At global scope:
_6MotionSwitch:185: error: expected unqualified-id before 'void'
 void lightsOutON(){
_6MotionSwitch:185: error: expected constructor, destructor, or type conversion before 'void'
/home/dave/Arduino/_6MotionSwitch/_6MotionSwitch.ino: In function 'void checkOutTimer()':
_6MotionSwitch:221: error: 'lightsOutON' was not declared in this scope
       lightsOutON();       //if so, turn the lights on
exit status 1
'lightsOutON' was not declared in this scope

And the code attached due to 9K limit…bad as it is:

_6MotionSwitch.ino (8.59 KB)


That line of stars needs a slash in front or it's not a comment and it is going to cause issues.

Look at the error after the lightsOutOn not declared. It says it was expecting something before the definition of lightsOutOn. It saw all those stars and thought you were defining a pointer to a pointer to a pointer to a pointer to a pointer to a pointer and never finished by giving a variable name.


Thanks Delta_G. Your help is SO appreciated!!

Such a stupid thing that I drove myself nuts over. I think I need to change the comment color so I can see more clearly how stupid I can be!!

This community is wonderful!


For anyone looking, and in the interest of sharing, the code is working now. I fixed pin assignment errors in original file.

It is likely I will later use the led on pin 13 to flag an error if the switch input lines are both on. Since everything will plug in individually, solving which switch line faulted will be just a matter of unplugging each switch. For those new to arduino, pin 19 =A5 used as a digital input.

Attached is working code, and should compile for UNO etc.

_6MotionSwitch.ino (8.63 KB)

For those new to arduino, pin 19 =A5 used as a digital input.

Not on all variants.