Hi All,
I am currently working on my 4th year capstone project and we are trying to build a fruit-picking robot that can follow magnetic track on ground, we bought a 8-bit magnetic stripe sensor from China and it has 8 of NPN Open collector output which can read the status of each point on magnetic sensor.
But it seems that I cant correctly read the values from serial monitor, which will always return a value of 1(HIGH) for all of 8 sensors.
Please see attachment for more information.
Thanks!
If you want more people to help you, then please post code according to the forum guidelines.
In-line, with code tags. Not as an image.
Seems you are using pin0 (RX) and pin1 (TX) for the sensor.
Can't do that.
Those pins are already used by the USB<>Serial chip.
Don't see a ground connection between sensor and Arduino.
The sensor can't pull the data lines to ground if there is no common ground.
Post a link to the sensor.
This single line could replace the whole pinMode block in setup().
for (int i = 2; i <= 9; i++) pinMode(i, INPUT_PULLUP); // set pin 2-9 to input with pull up
Leo..
Thank you so much! The problem is now solved

