Can anyone help me solve these errors?

Hello,
I’m New to coding and arduino field,

I have been working on project - Automatic guitar tuner,
Hardware is Ready but I’m stuck with code part.

I have one which has few errors can anyone help me solve these errors

Code attach below.

Thanks

agt.ino (11.1 KB)

    if (abs(newSlope - maxSlope) //record new data and reset time

Missing closing bracket on if test

Hey,
Thanks for the reply.

Solved two - three errors by your help.
Still getting few errors

Not able to solve Please help… :frowning:

for (byte i=0;i totalTimer+=timer[i]); 
}

exit status 1
expected ‘;’ before ‘totalTimer’

Kindly check the code once again pleaseee

code.ino (11.1 KB)

Are you missing a condition in that “for”?
Like == or < ?

I dont know sir :(

I trying to make project similar to this one http://www.instructables.com/id/Automatic-Guitar-Tuner/

Code provided by author has many errors, need to solve it.

Kindly help sir

Code provided by author has many errors

It’s an Instructable - what do you expect? :smiley:

Have you got a servo that is capable of turning the guitar tuning knobs ? If so, then how is it powered ?

Yes, I have an Continuous rotation servo, It is powered externally with ground common with arduino.

Hardware part I think it is done but Code is not working can you can guys help to solve the errors?? Please

Have you taken note of the problems pointed out in this thread and corrected them ?

Yes

Now there are new list or errors after correcting them.

NEW ERRORS LIST :

C:\Users\Neel-laptop\Desktop\code\code.ino: In function ‘void __vector_21()’:

code:122: error: expected ‘;’ before ‘totalTimer’

for (byte i=0;i totalTimer+=timer*);*

  • ^*
    C:\Users\Neel-laptop\Desktop\code\code.ino: At global scope:
    code:132: error: expected unqualified-id before ‘else’
    else{//crossing midpoint but not match
    ^
    exit status 1
    expected ‘;’ before ‘totalTimer’
    CODE ATTACHED BELOW.
    code.ino (11.1 KB)

for (byte i=0;i totalTimer+=timer);You're still missing code tags, a condition, and the semicolon at the end of the line should be a little further to the left. I can't see the rest of your code, so you'll have to fix that yourself

Here the small snippet of the code

if (prevData < 127 && newData >=127){//if increasing and crossing midpoint 
newSlope = newData - prevData;//calculate slope 
if (abs(newSlope-maxSlope)) //record new data and reset time 
slope[index] = newSlope; 
timer[index] = time; 
time = 0; 
if (index == 0){//new max slope just reset 
PORTB |= B00010000;//set pin 12 high 
noMatch = 0; 
index++;//increment index 
} 
else if (abs(timer[0]-timer[index])) //sum timer values 
totalTimer = 0; 
for (byte i=0;i totalTimer+=timer[i]); 
} 
period = totalTimer;//set period 
//reset new zero index values to compare with 
timer[0] = timer[index]; 
slope[0] = slope[index]; 
index = 1;//set index to 1 
PORTB |= B00010000;//set pin 12 high 
noMatch = 0; 
} 
else{//crossing midpoint but not match 
index++;//increment index 
if (index > 9){ 
reset(); 
} 
} 
}
if (abs(newSlope-maxSlope)) //record new data and reset time 
slope[index] = newSlope;

Are you missing braces here?

I dont know :confused: :frowning:
I’m new to coding sir.
I’m Attaching the code .ino file

Can you solve the errors if possible. and attached the code again.

I would be a great help…
Please

code.ino (11.1 KB)

There is a modified version in that instructable in a comment by Timothyi2. That will at least compile.

Whether it does what the original author intended is another question. You will have to ask the questions if it does not work in that instructable. Maybe you're lucky and get a reply.

Code is quite different. And doesnt work for the project. Thats the reason I'm using code given by Author.

But code has few errors.

It would be a great if you guys can help me solve it.

Thanks.

Try fixing this section

else if (abs(timer[0]-timer[index])) //sum timer values
{

totalTimer = 0; 

for (byte i=0; i totalTimer+=timer[i]) 
//  the needed syntax is generally for (byte i=0; some condition such as i <=200; i=i+1)
// so maybe for (byte i=0; i <= something; i = i+1) 
  { // do something here? Such as 
  totalTimer+=timer[i];
  }

}

Have you considered to compare your offending statement with the similar statement in the code that I referred to?