Please forgive me if this is 'obvious and basic' but I am totally new to Arduino and C++ so am struggling to understand where the problem is.
I am trying to build a project called Tiny Altimeter and slowly working my way through the various parts of the hardware and software to get it up and running.
Currently I am working on a sketch called altimetre_oled_bmp180_04.ino which has the code in the first attachment
(can't post code here because it exceeds text length of 9000 characters)
and when I attempt to verify the code the IDE throws the following errors
Using library button_1_0_0 at version 1.0.0 in folder: /home/ubuntu/opt/libraries/latest/button_1_0_0
Using library EEPROM at version 2.0 in folder: /home/ubuntu/opt/cores/arduino/avr/libraries/EEPROM
/tmp/466659420/Tiny_Altimeter/Tiny_Altimeter.ino:40:37: error: 'BUTTON_PULLDOWN' was not declared in this scope
Button button1 = Button(BUTTON1_PIN,BUTTON_PULLDOWN);
^
/tmp/466659420/Tiny_Altimeter/Tiny_Altimeter.ino: In function 'void setup()':
/tmp/466659420/Tiny_Altimeter/Tiny_Altimeter.ino:63:11: error: 'class Button' has no member named 'releaseHandler'
button1.releaseHandler(handleButtonReleaseEvents);
^
/tmp/466659420/Tiny_Altimeter/Tiny_Altimeter.ino:64:11: error: 'class Button' has no member named 'holdHandler'
button1.holdHandler(handleButtonHoldEvents,2000);
^
/tmp/466659420/Tiny_Altimeter/Tiny_Altimeter.ino:91:11: error: 'class Button' has no member named 'isPressed'
button1.isPressed();
^
/tmp/466659420/Tiny_Altimeter/Tiny_Altimeter.ino: In function 'void loop()':
/tmp/466659420/Tiny_Altimeter/Tiny_Altimeter.ino:100:11: error: 'class Button' has no member named 'isPressed'
button1.isPressed();
^
exit status 1
Obviously something is not right with the BUTTON stuff, but I am at a loss to try and track it down.
Any guidance would be very greatly appreciated, thanks in advance.
At the top of this Forum there is a "Useful Links". In that post there is a section called "C++ Programming" and within that is a section on Scope. Read that and see if it helps.
econjack:
At the top of this Forum there is a "Useful Links". In that post there is a section called "C++ Programming" and within that is a section on Scope. Read that and see if it helps.
econjack:
At the top of this Forum there is a "Useful Links". In that post there is a section called "C++ Programming" and within that is a section on Scope. Read that and see if it helps.
I am sure that you were trying to be helpful with this reply, however as far as I can see there is no such "Useful Links" anywhere within the Arduino site.
Using library button_1_0_0 at version 1.0.0 in folder: /home/ubuntu/opt/libraries/latest/button_1_0_0
The Button library used is the one in the Library Manager index:
That is a completely different library from the one your code was written for. You must import the button library your code was written for. I'll assume that is GitHub - tigoe/Button: A fork of Alexander Brevig's Button library for Arduino. If not, then adjust the below instructions accordingly. Unfortunately, the author of the Button library didn't use the correct folder name for the example sketches, which causes the import process to fail in the Arduino Web Editor. This adds some extra steps:
I did as suggested and re-verified the sketch, no more references to button!!!
It now throws another bunch of errors but I suspect they relate to similar library issues so I will work my way through the error messages to try and resolve them further.
Really appreciate the guidance and the clear, easy way in which you laid it out - very helpful.
It might be helpful to understand where this unwanted Button library came from. With the regular Arduino IDE, there are a handful of official Arduino libraries that come pre-installed. You can also choose from thousands of 3rd party libraries to easily install via Library Manager (Sketch > Include Library > Manage Libraries), but these are not pre-installed. With the Arduino Web Editor, they decided they'd pre-install all the thousands of 3rd party libraries in the Library Manager index. That can end up causing troubles when a different library than the one you wanted happens to have a file that matches the #include directive in your code (in this case, Button.h). It can be tricky to fix because you have no way to remove the unwanted pre-installed libraries. So it's a good idea to pay attention to the output that tells you which library is being used. The ones under the /home/ubuntu/opt/libraries folder are the pre-installed libraries. The libraries you import are under a folder that looks something like /tmp/703997053/custom.
The most reliable way I've found to do that is to add a dummy .h file, which has a filename that will not be found in any other library, to the library you import. For example, you could name the file UseThisButtonLibrary.h. You need to add some content to the file, otherwise the Arduino Web Editor won't import it. I recommend using an explanatory comment for this purpose:
// This file is used to force this library to be used
The library which contains a file from a previous #include directive will be used. So if you do this in your code:
GrahamM:
I am sure that you were trying to be helpful with this reply, however as far as I can see there is no such "Useful Links" anywhere within the Arduino site.