The problem is that when all the sensors are on white or on black it is giving me the same output i.e. all 1s when all the sensors are either on all black or on all white. It is giving me correct output when some sensors are on black and others are on white. I checked the sensor array with multimeter. It is correctly giving 5v on sensing white and 0.70v on sensing black on all the sensor. I don't understand why this is happening. Any help will greatly appreciated.
The result is same. I am just reading the value from pin 2.
When all the sensors are on white or black, it is giving me 0 on pin 2. When half the sensors are on black and other are on white it is giving me correct output on pin 2.
it is suppose to give all 1s when all the sensors are on white but it is giving me 0.
alivebj:
When all the sensors are on white or black, it is giving me 0 on pin 2.
Did you try INPUT_PULLUP ?
When you tried the single sensor code did you have the other sensors connected to the Arduino ? What happens if you disconnect all but one of them ?
I think you need to make a pencil drawing showing all the connections and post a photo of the drawing.
Have you a GND connection between the sensor device and the Arduino? I wonder if, when some of the sensors are different, the different outputs are making the circuit work properly in an electrical sense.
please give your variable meaningful names. You'll thank yourself later. And put the pin numbers in named constants rather than embedding them in your code. Bonus points if the names of your constants for pin numbers match the names of the variables in which you put the results of reading them.
Which would you rather debug when you return to this later. This: