Arduino Error Cannot Be Used As A Function
Contents |
> Programming Questions > calculation problem, ''expression cannot be used as a function'' Print Go Down Pages: [1] Topic: calculation problem, ''expression cannot be error expression cannot be used as a function c++ used as a function''(Read 822 times) previous topic - next topic arduino error expression cannot be used as a function adriaangittan Newbie Posts: 3 Karma: 0[add] calculation problem, ''expression cannot be used as a function'' Jan 15, 2016, cannot be used as a function mathematica 02:05 pm We have a problem with our code:''expression cannot be used as a function'' we want to perform a calculation.we are beginners with this software, so we would
Variable Cannot Be Used As A Function
really appreciate your help, thank you!our code:int val1;int Led1 = 2;int min1 = 167;int max1 = 980;int Switch = 8;int LDR1 = A5;const float Pi = 3.141593;float Result;void setup() { Serial.begin(9600); pinMode(Switch, INPUT); pinMode(LDR1, INPUT); pinMode(Led1, OUTPUT);}void loop() { //LDR aflezen if (digitalRead(Switch) == HIGH) { val1 = analogRead(LDR1); delay(100); Result = tan(((Pi/180)((val1-985.38)/-74.155)); arduino function // Here is where arduino says it is wrong Serial.println("de wrijvingscoefficient is: ", Result); digitalWrite(Led1, HIGH); delay(1000); digitalWrite(Led1, LOW); delay(150); exit(0); }}; AndyInSurrey Full Member Posts: 102 Karma: 21[add] Re: calculation problem, ''expression cannot be used as a function'' #1 Jan 15, 2016, 02:29 pm You have 1 too many opening brackets, try:Code: [Select]
Result = tan((Pi/180)((val1-985.38)/-74.155));
AWOL Global Moderator Brattain Member Posts: 40,354 Karma: 1134[add] I don't think you connected the grounds, Dave. Re: calculation problem, ''expression cannot be used as a function'' #2 Jan 15, 2016, 02:29 pm Code: [Select] Result = tan(((Pi/180)((val1-985.38)/-74.155)); You're missing a multiplication operator.(and code tags) "Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.Do not send technical questions via personal messaging - they will be ignored. adriaangittan Newbie Posts: 3 Karma: 0[add] Re: calculation problem, ''expression cannot be used as a function'' #3 Jan 15, 2016, 02:40 pm Thanks for the quick repllies, we now got a new error, saying: "ex
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just https://forum.arduino.cc/index.php?topic=372175.0 like you, helping each other. Join them; it only takes a minute: Sign up “cannot be used as a function error” up vote 6 down vote favorite 1 I am writing a simple program that uses functions found in different .cpp files. All of my prototypes are contained in a header file. I pass some of http://stackoverflow.com/questions/4412619/cannot-be-used-as-a-function-error the functions into other functions and am not sure if I am doing it correctly. The error I get is "'functionname' cannot be used as a function". The function it says cannot be used is the growthRate function and the estimatedPopulation function. The data comes in through an input function (which I do think is working). Thanks! header file: #ifndef header_h #define header_h #include
a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or http://arduino.stackexchange.com/questions/14295/integrating-an-analog-signal-using-arduino-due posting ads with us Arduino beta Questions Tags Users Badges Unanswered Ask Question _ Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Integrating an analog signal using Arduino Due up vote 0 down cannot be vote favorite I have an 2 analog signal, and I want to calculate the difference between 2 signals (A0 and A1), then integrate an analog, but it doesn't work (I just started studying Arduino). Please could you show me how to deal with this problem? Thanks a lot float analogInPin = A0; float analogInPin1 = A1; float analogOutPin = DAC1; float FeqIn, FeqIn1, FeqIn2, FeqIn3, FeqOut, w, Triarea, Recarea, area, n, y, t; void setup() { Serial.begin(9600); // use cannot be used the serial port } void loop() { FeqIn1 = analogRead(analogInPin); FeqIn2 = analogRead(analogInPin1); FeqIn3 = FeqIn1 - FeqIn2 // integration area(1) = 0; y(1) = 0; for (n = 1; n = t; t++) { Triarea(n+1) = (0.5*t(2))*(FeqIn3(n+1) - FeqIn3(n)); Recarea(n+1) = t(2)*(FeqIn3(n)); area(n+1) = (Triarea(n+1) + Recarea(n+1)) + area(n); } } The error message is: Arduino: 1.6.5 (Windows 8.1), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)" _02.ino:3: error: 'DAC1' was not declared in this scope _02.ino.ino: In function 'void loop()': _02.ino:20: error: expected ';' before 'area' _02.ino:21: error: 'y' cannot be used as a function _02.ino:24: error: 'Triarea' cannot be used as a function _02.ino:24: error: 't' cannot be used as a function _02.ino:24: error: 'FeqIn3' cannot be used as a function _02.ino:24: error: 'FeqIn3' cannot be used as a function _02.ino:25: error: 'Recarea' cannot be used as a function _02.ino:25: error: 't' cannot be used as a function _02.ino:25: error: 'FeqIn3' cannot be used as a function _02.ino:26: error: 'area' cannot be used as a function _02.ino:26: error: 'Triarea' cannot be used as a function _02.ino:26: error: 'Recarea' cannot be used as a function _02.ino:26: error: 'area' cannot be used as a function 'DAC1' was not declared in this scope arduino-due signal-processing share|improve this question edited Aug 21 '15 at 12:16 CharlieHanson 882118 asked Aug 18 '15 at 6:58 Viphuchit Sirikhemaporn 112 Please copy and paste your act