Configure your sketch

As long as your Arduino is connected to your PC you easily can modify your code to meet your requirements.
But there are cases when you want to modify a sketch, and there is no editor and compiler nearby.
So, given you have some free ports, what you can do is setting the behaviour of your sketch with jumpers and checking them in the setup section.

As many shields use pins 8 to 13 and you better not use pins 0 and 1 reserved for serial transmission, often pins 2 to 7 may be unused. You can set one of them to LOW*) and enable the internal pull-up resistors of the others to get 5 digital inputs which can be set to zero by inserting a jumper. You can select between 25 = 32 different configurations without changing a single line of your code.

What you actually need is:

// pins 2 to 7 used for setting the configuration
int getConfig() {
  for (byte i = 3; i <= 7; i++) digitalWrite(i,HIGH); // internal pull-up resistor
  byte b = 0;
  for (byte i = 7; i >= 3; i--) b = 2 * b + digitalRead(i); 
  return b;

void setup() {

void loop() {}

*) Of course you can use one of the ground pins on the Arduino board, but they are far away and you need additional wires.
Recommended only when you really run out of port pins.

contact: nji(at)