hi,
am haveing a small problem dont know what esle to do but post here
im basicly trying to write a software that would the values of an adc where apot is conected to it .. and compare that value to what ever that was there previously wait wait wait checks it out tell the change of values has stoped then saves it in memory
am not really good in programming here that much
i thought it was because the values were signed, i tried to make them unsigned didnt work .. declared them as long and double didnt work either plus i still havent figured how to get it to save to memory .. so ill just paste the code here and hope anyone has any commecnts
{
long ADC_OLD[5]; //The old ADC value
long ADC_NEW[5]; //The new ADC value
int Read_Count = 0;
do
{
ADC_NEW[0] = analogRead(0);
if( ( analogRead(0) <= (ADC_OLD[0] + 25) ) && ( analogRead(0) >=(ADC_OLD[0] - 25) ) ) //Compare ADC to ADC_OLD
{
Read_Count++; //increment
}
//else
//{
// if(Read_Count > 0) Read_Count--; //decrement
//}
//if((analogRead(0)>ADC_OLD[0]+ 25)&&(analogRead(0)<ADC_OLD[0])){
//}
delay(1); // wait for a milli second (1000ms = 1 second, so hand must not move for 1 second to produce result//
for(int j=0; j<=4;j++) ADC_OLD[j] = analogRead(j); //At the end of the function eqaute
}while(Read_Count < 1000);
i thought it was cuz the adc in the arduino is 10bits and am defining it as 8 bits for the data types in ADC_OLD but no luck there either
please help