Go Down

Topic: SOLVED: Getting Error:- 'INPUT_PULLUP' was not declared in this scope (Read 5 times) previous topic - next topic

tack



tack,

The Mighty1284p core files lack that instruction.  I've had great success using the standard core files with my 1284p boards for several months.  Try the following change in the boards.txt file for your board:

Code: [Select]

#bobuino.build.core=arduino:arduino
bobuino.build.core=standard


Jon


The boards.txt is already set to standard, as per above.


The pins default to input, so if you just digitalWrite (pin, HIGH) that will have the same effect.


This is an error being received with a library, so it's not code in my sketch. I guess I could go and modify all the INPUT_PULLUP uses in the library to PinMode(pin, INPUT) and digitalWrite(pin, HIGH) but I was hoping there was a more elegant solution, such as updating the mighty1284P core files so I don't have to change the library every time an update is released.

Krupski



The boards.txt is already set to standard, as per above.


The pins default to input, so if you just digitalWrite (pin, HIGH) that will have the same effect.


This is an error being received with a library, so it's not code in my sketch. I guess I could go and modify all the INPUT_PULLUP uses in the library to PinMode(pin, INPUT) and digitalWrite(pin, HIGH) but I was hoping there was a more elegant solution, such as updating the mighty1284P core files so I don't have to change the library every time an update is released.


What if you just do this:

Code: [Select]

#ifndef INPUT_PULLUP
#define INPUT_PULLUP 2
#endif


?????
Gentlemen may prefer Blondes, but Real Men prefer Redheads!

James C4S

Does your 1284 variant use its own cores directory:  "/Java/hardware/arduino/cores/"?

in /Java/hardware/arduino/cores/arduino/wiring_digital.c
there is an if-condition for INPUT_PULLUP (which turns on the internal pull-ups)

while INPUT_PULLUP is #defined in Arduino.h.


If your variant has its own "cores" directory, you may need to add the code from wiring.digital.c's pinMode and the #define from Arduino.h.


This was added in 1.01 or 1.02.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

mstanley

Hi tack,

This is an error being received with a library, so it's not code in my sketch. I guess I could go and modify all the INPUT_PULLUP uses in the library to PinMode(pin, INPUT) and digitalWrite(pin, HIGH) but I was hoping there was a more elegant solution, such as updating the mighty1284P core files so I don't have to change the library every time an update is released.


If you don't mind running a quick test for me...

Change line 46 in keypad.h from:
Code: [Select]
#if defined(ARDUINO) && ARDUINO < 101

to:
Code: [Select]
#if !defined INPUT_PULLUP

And see if it works for you.  If so then I will update the library so you won't have to mess around with it.

-Mark Stanley

tack

Mark, I'll give that a try for you shortly.

What I had done as a quick fix was alter the arduino.h file, in my 1284P cores folder, to add #define INPUT_PULLUP 0x02

I'm guessing it was dirty though as there is probably some code in another file (like suggested with wiring.h) where INPUT_PULLUP is mapped to the two normal pinMode and digitalWrite operations.

I'll remove the line and try your fix and report back. If it works then it would fix it for all permutations, whether the 1284P cores get fully updated or not. It'll either be fixed in the cores and your fix doesn't take effect, or your fix covers it if no INPUT_PULLUP defined.

I'll report back shortly.

Many thanks for taking the time to respond and PM me that you had done so.

Go Up