# easy work!!!

need a very simple code,

I'm working on a simple fuel injector cleaner and I would like a code that will pulse a sold state relay very quickly.
I can add a photo of what I would like the circuit to look like
Thanks Alex

what I would like
1: have two button to control two options
2: button 1 I would like to pulse an led/relay with pwm with 3 different speed levels low, mid, high (high max at 230), with a 5 sec delay in between each cycle and stop at end of cycle
3: button2 turn on this (but instead of an led it will be a relay)

``````#define LED 3
#define KNOB 0

void setup() {
pinMode(LED, OUTPUT);
}

void loop() {
// Read the value of the potentiometer knob

// Map the potentiometer value to 1-255
int intensity = map(knobValue, 1, 1024, 1, 255);

// Output the respective value to the LED
analogWrite(LED, intensity);
``````

What's the budget?

Maybe a mosfet would be a good alternative to a solid state relay for DC applications such as vehicle electrics.
The analogWrite() statement which you have used in your sample code simply alters the duty cycle but not the frequency which, depending on the board, maybe between 500Hz and 1K. Is that what you want ?

The On/off time for each cycle will be about 10 Seconds ON 5sec Off

This is exactly what I want to do

And not sure what it would cost

The video shows the use of a mechanical relay so the frequency can't be much over 50Hz. Anyway, it is not an application for a mechanical relay (as some of the comments have pointed out).
What is the maximum frequency that you can pulse these injectors at ? Can you find a data sheet ?

Edit.
I've just found something here. Definition of Fuel Injector Pulse Width You get one pulse per intake cycle. If the engine is running at 6000 RPM that is pulse rate of 50Hz. The width of the pulse determines the amount of fuel delivered (say 2.5 to 3.5 mS at idle ).
You can create the timings yourself in the loop() which is easy enough to do because the frequency is low . That would be bursts of x mS on and y mS off.