Is there something diffrent between UNO en MEGA on the AnalogPins?
While connecting an LDR on UNO (A0) the SerialPrint nicely returns lower values if LDR is in the dark.
When i try to connect the same wiring to the MEGA on pin A0 it just returns 1023.
Why is that? is There something wrong with the analogPins on my Mega?
Please help. Can't find anything online with simular problem.
When i unplug all pins and just read the A0 the value serial print returns is 1023.
If i plug the A0 directly to ground the value is 1023. (All other pins unplugged). This should be 0 (zero) right?
if i plug the A0 directly to VCC the value returns is 1023.
Kumalix:
When i unplug all pins and just read the A0 the value serial print returns is 1023.
If i plug the A0 directly to ground the value is 1023. (All other pins unplugged). This should be 0 (zero) right?
if i plug the A0 directly to VCC the value returns is 1023.
There is a mismatch between what is set as an INPUT and what you are printing to the serial port.
I'm not sure if there is a difference in the default pinModes between the Uno and Mega, but that could also contribute to your problem.
const int crashPin1 = A0;
void setup() {
pinMode(A0, INPUT); // not A1 as in previously posted code
Serial.begin(115200);
}
void loop() {
Serial.println(analogRead(A0));
}
I know guys i understand your point but i'm not that new to arduino .
I'm 100% sure i use the correct analog-pin in hardware as in software!
On the Uno there is no problem only on the mega.
I have check the correct hardware/ software pin 50 times by now.
Went one analog pin by one from A1 -> A15 (and corrected te code to mach the wired pin.
Don't know whats wrong. Maybe i just need a new Mega. even though this one is 1 month old.
Kumalix:
I know guys i understand your point but i'm not that new to arduino .
I'm 100% sure i use the correct analog-pin in hardware as in software!
On the Uno there is no problem only on the mega.
I have check the correct hardware/ software pin 50 times by now.
Went one analog pin by one from A1 -> A15 (and corrected te code to mach the wired pin.
Don't know whats wrong. Maybe i just need a new Mega. even though this one is 1 month old.
try reversing the black and red wires as shown in your OP to see if the analog read now yields a value of 0 instead of the 1023. If so, suspect that the resistor has an open circuit.
replace the ldr with a resistor of the same value as the existing resistor (10K ? ) and see if the analog reading is now about 512.
disconnect the red, black and yellow wires from the arduino and measure the resistance between the red and the black wires. The value of the resistance should change according to the ambient light.
Kumalix:
If i plug the A0 directly to ground the value is 1023. (All other pins unplugged). This should be 0 (zero) right?
Yes, unless the wire is broken, or you route it over some breadboard with bad pins or interrupted power rails.
We need to see a REAL picture of the setup, and very simple/short code that you use with it.
99.99% of problems here is user error.
Leo..