+2  A: 

I think you may have left off a closing comment here:

/*The level value is from -1 to +1 and represents the duty cycle to be sent to the motor. Converting to radians helps us stay within these limits >>>*/<<<
Shoko
Good eye, but I don't think he got that far in his compilation. +1 Anyway, as there is no way this code could compile without this fix.
Andres
This is really useful, thanks! ^^
T.H.
+4  A: 

You most likely have the wrong MCU specified for your build. While DDRA exists on the ATmega1280 on an Arduino Mega, DDRA does not exist on the ATmega328 of a regular Arduino.

If you're using the Arduino UI, go to Tools | Board and choose Arduino Mega.

If you're using your own build system, you'll need to update the value that you specify for -mmcu= on the gcc command line.

R Samuel Klatchko
Thanks a lot! Actually, once I change the Board to an Arduino Mega, this error is no more. I have : In function 'void sample_inputs()':error: '92' cannot be used as a function In function 'void timer_init()': In function 'int main()':
T.H.
A: 

When the compiler tells you that something "was not declared in this scope," as yourself this question:

What scope was is declared in?

If you can't answer that question, then you've discovered the problem. After all, if you don't know what that name refers to, how can you expect the compiler to? Remember that you are the expert on any code you write.

If you can determine what scope the thing is declared in, then the next task is to determine how that scope relates to the scope you're trying to use it in. Typical problems include (but are not limited to) the following:

  • It was declared in some other namespace. Use the :: scope-resolution operator to give a fully qualified name.
  • It was declared as a member of a class and you're trying to use it in a standalone function. Either find a instance of the class and access the variable or function through that object, or change the class to have your new function as one of its members.

If you can't find what scope it was declared in, then there are a few things that might be wrong:

  • You've spelled it wrong. Check the spelling in the documentation and fix your code.
  • It's declared in some header that you've forgotten to include. Figure out where it's declared and add the appropriate #include directive. This is probably the problem in your case.
  • It's not declared anywhere. Figure out where it should be declared and declare it there yourself.
Rob Kennedy
A: 

Hi,

Why not have a look at the arduino code here for a self balancing arduino robot.

The skateboard is very similar in principle. I had not even heard of Arduno when I built the skateboard otherwise I would probably have used one, the learning curve would have been much faster.

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1225283209

John

John Dingley
A: 

Hi again,

Here is a link to reasonably straightforward Arduino code for control of a DIY Segway.

This would be a better starting point for your skateboard I think.

http://diysegway.blogspot.com/

Best wishes

John

John Dingley