Page 1 of 1

DigitalRead not working

Posted: Sun Jul 10, 2016 2:18 pm
by kath2
Hi -

I'm at the point in a project where I'm trying to add a few control switches, and for some reason digitalRead is giving me nothing.

Code: Select all

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
   
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(1, HIGH);
  Serial.print("Pin 2: "); Serial.println(digitalRead(2));
  Serial.print("Pin 3: "); Serial.println(digitalRead(3));
  delay(1000);
}
I was then connecting the pins to GND or VBAT and was getting:

Code: Select all

Pin 2: 0
Pin 3: 0
No matter what I did, and I also wasn't able to write digital pins to high.

Any thoughts as to what might be up?

Thanks.