I have written a C++ code for my project. I am having trouble storing values in arrays. I have written a code for measuring the value from hardware. For storing first value I have used Array, that is working fine. For example when the program get started, I got initial value lets say 53.6854.
Now I want to take this value into another void for comparing with other values. So according to first value, I am going to check remaining values. I can't fix the constant value because Initial value will change every time.
I want to take that first value to void Motion::Synchronization(QString motiontype) else if(type == 2)
Then according to stored first value I will check remaining value. If that is not equal to that value I will create the other logic to reach that position. For that I need first value. I don't know how to change, or else any other ways to get the first value ? Assist me to solve this issue.
Whenever the program get started that time all thread will get started. From main thread I have defined it will go to
void Motion::slow()
so inside
float n[ ] = {Thread::data};
this will read the first value from hardware. After that it will move to
1 2
void Motion::Synchronization(QString type)
{
Then this condition will work continuously
1 2 3 4
elseif(type == 2)
{
delay(20);
}
So inside of this also I have written
Thread::data for further value and position identification
Now I want to compare with first value from
void Motion::slow()
I don't know how to take that from here to there. Because values will change every time If I don't have first value, I can't compare. So now I got the first value problem how to take that value from
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
void Motion::slow()
{
float n[ ] = {Thread::data}; // from here
check(n[0]);
}
void Motion::Synchronization(QString type)
{
if(type == 1){
}
elseif(type == 2)
{
// to here
delay(20);
}
}