Society of Robots - Robot Forum

Software => Software => Topic started by: roboplane2.0 on March 25, 2007, 12:41:57 PM

Title: Cprogramming
Post by: roboplane2.0 on March 25, 2007, 12:41:57 PM
im a little confused with cprogramming codes and all that ive been looking at some tutorials on it every time i try to do something with the tutorial on Arduino-007 Alpha it keeps saying error:invalid fuction declaration could someone help me with that?
Title: Re: Cprogramming
Post by: JesseWelling on March 25, 2007, 01:04:42 PM
generaly when you have a problem with code you need to post the code and the error. other wise we can't really figure it out...
Title: Re: Cprogramming
Post by: roboplane2.0 on March 25, 2007, 01:07:37 PM
 #include
<stdio.h>

int main()
{
  printf( "I am alive!  Beware.\n" );
  getchar();
  return 0;
}


error:invalid fuction declaration



and what is a pseudocode

Title: Re: Cprogramming
Post by: JesseWelling on March 25, 2007, 02:00:38 PM
try puting the #include <stdio.h>  all on one line other-wise printf() or getchar() are not defined in stdio.h for your micro controller. What you can do is find where stdio.h is and see what it has declared....
Title: Re: Cprogramming
Post by: roboplane2.0 on March 25, 2007, 02:32:01 PM
i dont get what you said
Title: Re: Cprogramming
Post by: JesseWelling on March 25, 2007, 02:45:08 PM
ok so printf() and getchar() are functions right?
well pretty much what it's telling you is that it can't find those functions.

So either stdio.h doesn't have those functions
*or*
you are not including stdio.h in the right way
*or*
stdio.h simply doesn't exist with the compiler you are using.

Title: Re: Cprogramming
Post by: roboplane2.0 on March 25, 2007, 08:12:17 PM
im using Arduino-0007 Alpha. Heres the link:
http://www.arduino.cc/en/Main/Software (http://www.arduino.cc/en/Main/Software)
Title: Re: Cprogramming
Post by: JesseWelling on March 25, 2007, 10:41:37 PM
I'm not really familiar with arduino. but I'm guessing you should look at some of thier tutorials before assuming that thier "Processing" language runs like straight C code. For one you are programing on a microcontroller so what exactly is printf supossed to do? If sdtout and stdin are defined to be serial connections I'd imagine that would work, the problem is that for the most part microchips won't use printf and getchar because they are too limiting without an operating system. I would ask your question here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl and you will probably get a more detailed response.
Title: Re: Cprogramming
Post by: Hal9000 on March 27, 2007, 08:38:17 AM
Yeah, seriously, start from the ground up.........the first thing you should do is blink an LED

http://www.arduino.cc/en/Tutorial/HomePage

Once you've played about with it for a while, then take a look at this page

http://www.arduino.cc/en/Reference/HomePage

To make your own stuff. This is how I would personally go about it :)

Good luck!