Hello everyone. I am new to this board, I have come across hundreds of threads across here for information. I am I guess ( back to new ) for programming in this language… about 7 years ago I was a heavy programmer and did a lot of robotics for competitions… but I have changed my skill set to PLC controls and mechanics. So I guess I need a serious refresher haha… here’s what I am struggling to do, I have tried to modify about a dozen RPM programs I have found around the net… what I am trying to do is have an RPM reader which will trigger an LED to stay on. I would like to be able to adjust how LONG the LED stays on, with an analog input. I am aware that if the delay on the LED is on for a longer period of time than the 1 revolution of the fan is, then it will cause some confusion. so I am having a lot of trouble with interrupts and delays… essentially this is what I have/need. I have an arduino mega 2560. I am trying to simulate an injector being triggered by an RPM, and to increase how long the injector stays open for using an analog signal. right now, I can only get the injector to stay open for as long as the IR sees the white tape. so as the fan spins faster, the injector stays open for a shorter period of time, but of course will pulse faster.
- LED connected to pin 12. to trigger ON after 2 fan revolutions, and to stay on depending on a potentiometer. to be interrupted/reset by the new 2 fan revolutions that follow.
-IR sensor (3 pin), ground, 5V, and signal connected to pin 2
-potentiometer ( 3 pin ) connected to analog A0
Any help would be greatly appreciated thank you for reading
injector_duty_cycle.ino (902 Bytes)