Go Down

Topic: Calling Functions in a program - error with not defined in scope while Globalvar (Read 135 times) previous topic - next topic

b3y0nd

I am calling functions in a program that I have defined and declared.

For some reason I am getting errors, only on certain functions, although they are all declared and called using the same syntax.

Attached is my code.

Any help / guidance appreciated.

slipstick

I am calling functions in a program that I have defined and declared.

For some reason I am getting errors, only on certain functions, although they are all declared and called using the same syntax.
And which functions are failing is a secret? We're supposed to guess? Is there a prize?

Steve

b3y0nd

attached was the code.

thought maybe download and compile?

Code: [Select]

finalprojectadjustedatschool:174:23: error: 'potMeasure' was not declared in this scope

 int adjustLightAmount(potMeasure) // function returning pwmIncrease, which is used with counter to illiminate the lights

                       ^

finalprojectadjustedatschool:195:18: error: 'loopCounter' was not declared in this scope

 int adjustLights(loopCounter)

                  ^

finalprojectadjustedatschool:174:33: error: redefinition of 'int adjustLightAmount'

 int adjustLightAmount(potMeasure) // function returning pwmIncrease, which is used with counter to illiminate the lights

                                 ^

C:\Users\Adam\Desktop\finalprojectadjustedatschool\finalprojectadjustedatschool.ino:174:5: note: 'int adjustLightAmount' previously defined here

 int adjustLightAmount(potMeasure) // function returning pwmIncrease, which is used with counter to illiminate the lights

     ^

exit status 1
'potMeasure' was not declared in this scope

[\code]

jremington


cattledog

Several of your function prototypes do not have correct syntax. Some do not have return values they claim to provide.

www.arduino.cc/en/Reference/FunctionDeclaration

There are many other compiling errors as well. Make sure you scroll up the error lists and fix them from the top down. You have some capitalization errors.

gfvalvo

attached was the code.

thought maybe download and compile?
Sure, if we were the ones asking for free help. But, I'm pretty sure that's you.

b3y0nd

Sure, if we were the ones asking for free help. But, I'm pretty sure that's you.
Didn't mean it like that.

Wasn't sure of communication protocols based on the code.  Wasn't sure if we had 100's of line of code how to go about asking for help about it either.

gfvalvo

The most effective way to get help when your program is large is to post an MCVE. Not many people are inclined to wade through 100s of lines of unrelated and messy code. Trim things down and post something that demonstrates the problem and nothing more.

outsider

3 clicks.  :)
Code: [Select]
Arduino: 1.8.5 (Linux), Board: "Arduino Nano, ATmega328P (Old Bootloader)"

DS18x20:174: error: redefinition of 'int adjustLightAmount'
 int adjustLightAmount(potMeasure) // function returning pwmIncrease, which is used with counter to illiminate the lights
                                 ^
Multiple libraries were found for "Servo.h"
 Used: /home/jca/sketchbook/libraries/Servo
 Not used: /home/jca/arduino-1.8.5/libraries/Servo
/tmp/arduino_modified_sketch_282878/DS18x20.ino:174:5: note: 'int adjustLightAmount' previously declared here
 int adjustLightAmount(potMeasure) // function returning pwmIncrease, which is used with counter to illiminate the lights
     ^
exit status 1
redefinition of 'int adjustLightAmount'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


b3y0nd


Go Up