I guess Im missing something fundamental. The following println returns a value of zero = 0. Pin 12 is not connected to anything. I thought the value would have been positive:
void setup() {
Serial.begin(9600);
pinMode(12, INPUT_PULLUP);
Serial.println(digitalRead(12));
}
Which Arduino board are you using ?
i see 1 printed
Board used is SEEED NANO
Not surprisingly I get 1 as the output from a classic Nano clone
I thought the output should be 1 (HIGH)
So this is a SEEED error? The SEEED NANO is supposed to be an exact clone of the Arduino NANO.
Yes. And several ppl have seen it. So you have something else going wrong.
Try another pin.
Make sure the pin is free of any connections.
a7
I have tried pins D2 thru D13
What happens if you connect the pin that you are reading to 5V ?
Try without a pinMode(), with pinMode() set to INPUT and pinMode() set to INPUT_PULLUP
A0 is used as a connected digital I/O pin. But the Loop code has no statements in it. The given code was a simple test code.
Disconnect everything from the board and try the test again
This is a test code because of this behavior observed in a 300 line code where D12 has to be default positive
Try the tests that I suggested with nothing connected to the board
The D12 input comes from a SPST switch where LOW is active. There is no HIGH input, but the larger code needs a HIGH in certain IF statements. I could just add a pullup resistor to D12 on the perf board, but I was trying to avoid that.
connecting D12 to 5V returns 5V
Please perform the requested tests and report your findings
I will try the tests and report back. It's 4:00 in the morning here, so you wont hear back for a while.
I tried ALL UKBob's suggestions, and they all returned the correct output including the problem I originally asked about. The only thing different was that when I left the discussion, Ipower the NANO off and the next day it got powered back on. ? Nothing changed at all...except for conducting UKBob's suggestions. I dont think this problem has an answer. I feel like I have wasted everyone's time.
That's ridiculous. The Seeeeeeed Nano is a clone, the sketch should print "1" and if it isn't, there must be something you aren't telling us.
You can't get in the habit of giving up on simple questions like this.
No, it does not. What does it print?
a7
I do not understand your response. I wrote you that the println statement consistently returned a
value of 0 (zero). Should I have ignored THAT? No matter what steps I took, that statement
returned the same value of 0. Now what would YOU think? I wrote to tech support EXACTLY
what happened. Nothing more. I tried for hours to understand and fix the problem before
I wrote to your tech support. What would you expect?
You received EXACTLY what happened. Do YOU understand that??? I am not an idiot.
I have used Arduinos for 20 years. I never write for any tech support anywhere unless I have
no clue as to how to fix a problem and have tried ALL means to solve a problem.
DO NOT be rude to your customers. Not all of them are idiots.
POWER OFF/ON SOLVED THE PROBLEM. I have no clue why. It makes NO difference if
YOU think that is ridiculous.
I have put pullup resistors in the hardware design to make sure nothing like this can ever happen
even if it is ridiculous.
David Richardson, Ph.D
Aerospace Design Engineer for 40 years
| alto777
May 9 |
- | - |
walshrd:
I dont think this problem has an answer.
That's ridiculous. The Seeeeeeed Nano is a clone, the sketch should print "1" and if it isn't, there must be something you aren't telling us.
You can't get in the habit of giving up on simple questions like this.
walshrd:
connecting D12 to 5V returns 5V
No, it does not. What does it print?
a7