what does it represent in Arduino coding
if i want to do a program
-->that every time it have some new value for particular sensor
it stops whatever it`s doing and display a new value ?
what functions can i use ?
i checked the attachInterrupt but the function must take a pin
and i kinda can`t provide this
because the reads are analog and it had to be processed before displaying
Use a variable to hold the last reading; initialize to e.g. -1.
Do a reading and store in a variable. If the reading differs from the last reading
1)
copy current reading to last reading so it is remembered
2)
take the needed action
sterretje:
Use a variable to hold the last reading; initialize to e.g. -1.
Do a reading and store in a variable. If the reading differs from the last reading
1)
copy current reading to last reading so it is remembered
2)
take the needed action
yes i have applied this part
but there is another actions going in the loop
what i need is if the Arduino happens to be in on of these action and a new read come
stop this action and print the value
You have not posted your code so we cannot see what it is doing.
At a guess you are using the delay() function and/or a for loop and/or a while loop that stops the loop() function running freely so that the sensor can be read frequently and the display updated.
Generally, you don't use attachInterrupt for reading sensors unless you are dealing with things that happen within milliseconds, or that need to be timed accurately to the microsecond.
If you are doing job A that takes a while, and you need to occasionally handle job B too, then you need to write your code so that it can do a little bit of job A at a time.