|
|
Re: Arduino "function" issue. [message #1791525 is a reply to message #1791477] |
Mon, 02 July 2018 00:04 |
Travis Durf Messages: 3 Registered: June 2018 |
Junior Member |
|
|
Thanks for the info. As it took a few days for post to be approved and posted here, I did alternately come across the issue was the functions need forward declared. Like you have suggested. The other person that suggested that may be the case, was reading the eclipse newsletter that details the plugin and read it that it should "not" be needed. I reread it and it actually seems to say that it "is" needed because it seems to be saying that you "don't" have to on the standard Arduino IDE, meaning you do have to on this.
So the correction is either to move buttoncheck() before anything that calls it, or define it before hand it seems. I almost tried moving the buttoncheck() up in the code as I had some vague recollection of something like that in some other programming I did years ago, but I have long forgotten if it was when I was doing some thing with C++. I am glad I found out I can declare the functions at the top then finish them out down below in an alternate order.
void buttoncheck();
void loop() {
buttoncheck();
}
void buttoncheck(){
int reading;
reading = digitalRead(buttonPin);
}
It is easier to define them at the top before any functions happen, rather than going down the line and find out something is "out of order" trying to sort out why something wasn't happening. If I miss that it is marked with an error, it still compiles and sends to the Arduino board, it just fails to call the function when it was supposed to. Other errors would cause it to not send it and give an error, but these seem to still go through and the rest of the code still operates.
|
|
|
|
Powered by
FUDForum. Page generated in 0.28660 seconds