Hey everyone, hope all is well.
I am working on a project for work right now, that will be used to test these new cables that we are manufacturing. The cables have 5 wires and I plan on using an ATMega328p w/ bootloader to design a kind of cable scan. I have two connectors to plug the wires into and on one end it will be fed into an analog input (5x total) with a 10k resistor to ground. On the other end of the cable there will be 5 different value, precision resistors attached to VCC. So this will set up a voltage divider that will return a specific value for each wire, and if the cable is wired wrong and an analog input sees a different value, it will send out a FAIL (red LED connected to digital output driven by transistor) and if all the values are within specs, it will output a PASS (green LED connected to a second digital output driven by transistor). I am a hardware engineer, so my software capabilities are limited, which is why I am using the Arduino, since we used them in school.
So I am wondering if anyone has some example code that I could look at that does something similar to this, checking multiple analog inputs, and if all conditions are met, sending out a digital high signal to one pin, or if conditions are not met, send out a digital high to a separate pin.
I know I would use something like....
int AnalogValue = analogRead (analogPin);
if (analogValue > threshold) {
digitalWrite (ledPin, HIGH);
}
else {
digitalWrite (ledPin, LOW); }
I understand that is how to check an analog pin, and if it meets a certain condition, output to a digital pin. However I am unsure of how to string all 5 analog inputs together to make sure that each individual analog pin is within the tolerance specified, and then if all five analog lines are correct, then send a PASS indicator out, otherwise send out a FAIL.
If anyone could point me in the right direction, I would greatly appreciate the help. Thanks very much guys, all help is greatly appreciated, especially since I am under the gun on getting this tester on the line. Thanks again guys!