modifying built in libraries?

i'd like to make a small change to the wire librarie to patch out the internal pullups, where is the source and how does it get included into my project?

thanks

i guess i found it here C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src

steveh2112:
i’d like to make a small change to the wire librarie to patch out the internal pullups, where is the source and how does it get included into my project?

thanks

i guess i found it here
C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src

Any library gets included in your program with a line similar to:

#include <Wire.h>

I would strongly advise against modifying the standard libraries. Better to create your own custom library by copying the code over to your own file, give it a unique name, then make the modifications. Modifying a built-in library will likely break compatibility with other programs, and you also run the risk of having the IDE wipe out all your modifications if the library gets updated.

After calling Wire.begin() in setup(), add pinMode (19, INPUT); digitalWrite (19, LOW); pinMode (18, INPUT); digitalWrite (18, LOW);

to turn off the pullups. And the pinModes might not even be needed.

CrossRoads: After calling Wire.begin() in setup(), add pinMode (19, INPUT); digitalWrite (19, LOW); pinMode (18, INPUT); digitalWrite (18, LOW);

to turn off the pullups. And the pinModes might not even be needed.

Either the pinMode()'s or the digitalWrite()'s will do it.

If you do decide to modify one of the standard libraries be sure to make another copy before you change it and give it a different name. That avoids a huge amount of confusion later on when you might need to use the original version, or when you want to share your modified version with someone else.

...R

steveh2112: i guess i found it here C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src

I think you've been given some good advice already, but since you are showing a desire to look/play around in the libraries, it may be useful for you to understand the way the Arduino IDE handles this type of library:

You should be aware that each hardware package comes with its own version of the Wire library, which is used when a board of that hardware package is selected from the Arduino IDE's Tools > Board menu. The reason for this is that the Wire library is architecture-specific so each architecture needs to write the library differently. The path above is the Wire library used by the Arduino AVR Boards (Uno, Leonardo, Mega, etc.). If you have one of the Arduino SAMD Boards (Zero, MKR, etc.) selected, a different version of the Wire library will be used. Same for ESP8266, and so on.

To make things more confusing, the version of the Arduino AVR Boards hardware package bundled with the Arduino IDE is only used if you haven't installed a different version via Boards Manager (Tools > Board > Boards Manager). Hardware packages installed via Boards Manager are installed to a different location.

Here's the easiest way to find the copy of the library which is actually in use for the selected board:

  • File > Examples > Wire
  • Select any of the examples for the Wire library.
  • Sketch > Show Sketch Folder

That will open the folder of the example sketch, which is under the Wire library installation folder. You can simply navigate up a couple of folder levels to get to the Wire folder.