if button 1 pressed within 5 seconds, green led light up, if not pressed within 5 seconds, red led light up, what function to use?
Within 5 seconds of ‘what’…?
Whatever you choose, an event timer using millis() is pretty straightforward.
After reaching the inspection station (S5 is activated), the conveyor stop and buzzer is turned ON while the work piece is inspected: i)If it pass inspection process (Button 1 is pressed within 5 sec), green light blinks 3 times at 0.5 sec interval. I.e. 0.5sec ON and 0.5sec OFF. ii)If it fail the inspection process (Button 1 is NOT pressed within 5 sec), red light blinks 3 times at 0.5 sec interval. I.e. 0.5sec ON and 0.5sec OFF. After the blinking, whether the inspection is passed or failed, the green light is back ON while red light and buzzer is OFF.
Hello
Post your sketch, well formated, with comments and in so called code tags "</>" and schematic to see how we can help.
Have a nice day and enjoy coding in C++.
You need to get a signal from the conveyer belt has stopped in order to start off the process. This signal needs conditioning so that it is in the range of an Arduino. To prevent problems with ground it is best if this signal is isolated from the Arduino by using an optical isolator.