I've built a simple wire harness tester using an Arduino Mega that is programmed to send voltage to a sequence of pins and LEDs light to show continuity for each circuit. The system is wired so that a bank of LEDs light in sequential order using a loop with a delay which tells me the wire harness is wired correctly.
I am a novice (is there a step below novice?). I am looking to develop a program that will sound a buzzer only if the LEDs light in the correct sequence.
Any help would be greatly appreciated.
Thanks!
To sound a buzzer you need a buzzer. There are two types active and passive. With an active buzzer you need only apply a voltage across it and it buzzes. With a passive buzzer you need to connect it to an output that you waggle up and down. The speed of the waggling determines the pitch of the buzzer.
Most buzzers will work from 20mA or less and you can connect directly to a pin. Some electromechanical ones need an extra transistor to boost the current from the Arduino output pin.
Incorporate it into your program by having the program decide if the correct sequence has been generated and lighting a “passed” LED when it has. Then simply use that pin for your buzzer.
only if the LEDs light in the correct sequence
This suggests your sketch keeps track of successful pin tests by checking the ‘other’ end of the cable.
If that’s in place, you need to ‘score’ each scan, starting from the first wire and score=zero.
Add +1 for each successful wire test, then after the cable scan is complete, if score == num_wires, you have a good cable.
Reset score, and repeat for next cable set.