I have got values coming from sensors
So guys let me tell u the boundaries how it works.
I only have Boolean variables and if else statements to use. Others loops I have tried but in Real time Data coming from sensors it don't work like that.
So the problem is :
I get values from stream
3.9 3.9 3.9 3.5 3.9 3.9 3.9 3.9 3.9 3.9 3.9 3.9 3.9 3.9 3.9 3.5 3.9 3.9 3.9 3.9 3.9 3.9 3.9 3.9 3.9 3.9 3.9
Above stream comes many times . I need to do b++ when I get this streams once.
var count1 = 0
var count2 = 0
var countValue1 = true
var countValue2 = false
if(x1 == 3.9)
{
if (countValue1)
{
count1++
count2 = 0
if (count1 == 22)
{
count1 = 0
b++
// if(x1 < 3.5 )
countValue1 = false
countValue2 = true
}
}
else
if (countValue2)
{
count2++
count1 = 0
if (count2 == 22)
{
count2 = 0
b++
countValue1 = true
countValue2 = false
}
}
}
In First Event it works fine. The second times I run the app my b value increase by 4 or 3 sometimes. I don't know why this happen.
Aucun commentaire:
Enregistrer un commentaire