Is it valid programming to include a delay in a map function? Like this;
y=map(x,70,0,delay(0),delay((z*55.55); //z>100
I have include 70 here which is actually a variable, will not always be 70. I could have used 'm' for example. Too many variables makes for confusion as some have told me on this forum.
The delay() function does not return a value so what you are trying is nonsense
What is it that you want to achieve ?
if you want a variable delay based on map, you need to write this differently
is this what you want to achieve ?
delay(map(x,70,0,0,z*55.55));
that would say create a linear function that goes through (70, 0) and (0, z*55.55) and find the y for the variable x on that line to calculate the delay.
problem fixed Bob. I should have seen it before. You are right it would not work like that. I will just enter the numbers. Then when I have 'y' I will use 'delay y'.
If I tried to explain what I hope to achieve this topic would go on too long. It is best just to fix one small part of a complicated sketch at a time.
Kind of like that. Just using the numbers in the map function. Then getting the value of "y". Then using 'delay y'. The way I put it first would not work. The numbers give a delay time for the rest of the sketch. z should be z=1000 to convert seconds to milliseconds to work in the delay function in Arduino.
The entire reason for programming code to exist, is to make what's going on easy to understand for humans. DON'T GET ALL CLEVER AND TRIXY WITH IT.
-jim lee
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.