I have this because then I want to add the code switch.
give the function that if the sensor is not HIGH, even if you press the swtich 12 is LOW OUTPUT
Robin2:
Almost certainly you will be better not using the delay() function. Have a look at how millis() is used to manage timing in several things at a time.
It is much easier to design your program to use millis() than to convert from delay() to millis() at a later stage.
...R
I knoww but I prefer the delay function for this case, thankssss
You have not clearly described what you want it to do, as far as I can tell.
What kind of input? pins being high/low? Serial data stream? Sensor readings?
What should it do in response to these inputs? Just pause for the stated number of milliseconds? You talk about it doing something to pin 12, but it's not clear what you want it to do to pin 12.
As far as I can tell looking at your code you have made no attempt to do what you're asking about, nor have you described what it is.
Adriansalguero:
I knoww but I prefer the delay function for this case, thankssss
That is not a good response - though per my comments above, I do not think you've even given us enough information to say whether or not delay is inappropriate (though it almost never is - I rarely have delay called in more than one or two places)
But when you say "I want help crossing this lake in my motorcycle" and we say "a motorcycle is not an appropriate vehicle for traveling on water, you should use a boat", your response shouldn't be "I knowww but I prefer a motorcycle"
I want a switch connected to the digital inputs of Arduino, this switch will control the ignition timing of the pin 12, once you pressed the switch pin 12 will be put high.
DrAzzy:
But when you say "I want help crossing this lake in my motorcycle" and we say "a motorcycle is not an appropriate vehicle for traveling on water, you should use a boat", your response shouldn't be "I knowww but I prefer a motorcycle"
I want a switch connected to the digital inputs of Arduino, this switch will control the ignition timing of the pin 12, once you pressed the switch pin 12 will be put high.
Do you meant that you have a 3 position selector switch and a momentary contact button switch
If the selector switch is at position 1 then pin 12 will go high for 2000 msecs when the button is pressed
If the selector switch is at position 2 then pin 12 will go high for 5000 msecs when the button is pressed
etc
and (if this is correct) I don't know what you mean by "ONLY happen if the sensor detected". Does that mean that there should be a test to see if a sensor (what sort of sensor) is attached before pin 12 is allowed to go HIGH ?
and (finally, for now) I don't understand what you mean by "Only with funcion delay."
I suspect that half of the work in creating a successful program is writing a clear and unambiguous description of the requirement
Adriansalguero:
OK, this is more or less what I want.
Is the ultrasonic sensor.
We might make some progress if you could respond to the posts that other make - sort of have a conversation.
You have not bothered to answer any of the questions that I took some trouble to write in Reply #8
If you don't understand my questions please say so, but don't ignore them.