Digital input: Not going HIGH

This should be so simple but I cannot figure it out...

I am hooking up my Arduino to a Automotive bank of 3 switches.

const int systemButtonPin= 2

int systemButtonState =0;

pinMode(systemButtonPin, INPUT);
systemButtonPin = 0;

In the loop
systemButtonState = digitalRead(systemButtonPin);

The Switch has a ground and a 12v in.
The Switch has a output that when measured is 11.9v on, and 0 off.

I take the output to a 5v stepdown which reads 4.9 on and 0 off.

The power out 4.0v (when on) from the stepdown goes to digital 2
Ground from the switch goes to the breadboard common ground.

When looking, the is always LOW (0) regardless of the switch setting..

When the switch is on, 12v goes to the stepdown and is 4.9 at the 2 digital pin. Why no change of state?


Show us a good schematic of your circuit.
Show us a good image of your wiring.
Give links to components.
Posting images:

Use CTRL T to format your code.
Attach your ‘complete’ sketch between code tags, use the </> icon in the posting menu.
[code]Paste your sketch here[/code]

If you are feeding more than 5v to an I/O pin DON’T.

What is a 5v stepdown ?

Well what you posted isn't real code but in your setup() you change the pin number of systemButtonPin from 2 to 0. That is why changes on pin 2 don't do anything. Perhaps you meant systemButtonState?

If you post the actual code you may get better answers.


const int systemButtonPin= 2


systemButtonPin = 0;

If systemButtonPin is defined as a const, then the instruction that changes it should create a compilation error...?

Yet another excellent reason why people should post the actual code they are using and not some (possibly mistyped) stupid little snippets.


Is your switch setup similar to the following diagram of Fig-1?

Codes to check that K1 is closed:

void setup()
   pinMode(2, INPUT);
   pinMode(13, OUTPUT);   //built-in L (LED) of UNO
   digitalWrite(13, LOW);    //L is initially OFF

   while(digitalRead(2) != HIGH);
   digitalWrite(13, HIGH);            //L is ON because K1 is closed and DPin-2 is at HIGH state.

void loop()

Press down K1 and check that L is ON. It establishes that HIGH has appeared at DPin-2 of Fig-1.