Go Down

Topic: i am Facing a lot of errors In my code .please help me .. (Read 224 times) previous topic - next topic

hydrabomb

EVERYTHING IN THE CODE I CHECKED SEEMS TO BE CORRECT ....BUT THESE ERRORS ARE still showing up..















Arduino: 1.8.7 Hourly Build 2018/09/12 02:23 (Windows 10), Board: "Arduino/Genuino Uno"

sketch_mar25a:10:3: error: variable or field 'setup' declared void

   Serial.begin(9600);

   ^

sketch_mar25a:10:21: error: expected ')' before ';' token

   Serial.begin(9600);

                     ^

sketch_mar25a:11:2: error: 'myservo' does not name a type

  myservo.attach(9);   //Servo control

  ^

sketch_mar25a:12:9: error: expected constructor, destructor, or type conversion before '(' token

  pinMode(2,OUTPUT);  //Motor driver pin 1

         ^

sketch_mar25a:13:9: error: expected constructor, destructor, or type conversion before '(' token

  pinMode(3,OUTPUT);  //Motor driver pin 2

         ^

sketch_mar25a:14:9: error: expected constructor, destructor, or type conversion before '(' token

  pinMode(4,OUTPUT);  //Motor driver pin 3

         ^

sketch_mar25a:15:9: error: expected constructor, destructor, or type conversion before '(' token

  pinMode(5,OUTPUT);  //Motor driver pin 4

         ^

sketch_mar25a:16:9: error: expected constructor, destructor, or type conversion before '(' token

  pinMode(6,OUTPUT);  //Ultrasonic Trigger

         ^

sketch_mar25a:17:9: error: expected constructor, destructor, or type conversion before '(' token

  pinMode(7,INPUT);   //Ultrasonic Echo

         ^

sketch_mar25a:18:9: error: expected constructor, destructor, or type conversion before '(' token

  pinMode(8,OUTPUT);  //Laser

         ^

sketch_mar25a:19:9: error: expected constructor, destructor, or type conversion before '(' token

  pinMode(10,OUTPUT); //LED

         ^

sketch_mar25a:20:9: error: expected constructor, destructor, or type conversion before '(' token

  pinMode(A0, INPUT); //LDR

         ^

sketch_mar25a:21:2: error: 'laserstatus' does not name a type

  laserstatus="OFF";

  ^

sketch_mar25a:22:2: error: 'servoangle' does not name a type

  servoangle=90;

  ^

sketch_mar25a:23:2: error: 'myservo' does not name a type

  myservo.write(servoangle);

  ^

sketch_mar25a:24:2: error: 'recordstatus' does not name a type

  recordstatus="NotRecording";

  ^

sketch_mar25a:25:2: error: 'requiredrecordstatus' does not name a type

  requiredrecordstatus="StopRecording";

  ^

sketch_mar25a:26:2: error: 'fr' does not name a type

  fr=0;

  ^

sketch_mar25a:27:2: error: 'br' does not name a type

  br=0;

  ^

sketch_mar25a:28:2: error: 'sr' does not name a type

  sr=0;

  ^

sketch_mar25a:29:2: error: 'rr' does not name a type

  rr=0;

  ^

sketch_mar25a:30:2: error: 'lr' does not name a type

  lr=0;

  ^

sketch_mar25a:31:2: error: 'i' does not name a type

  i=0;

  ^

sketch_mar25a:32:2: error: expected unqualified-id before 'for'

  for(int c=0;c<20;c++)

  ^

sketch_mar25a:32:14: error: 'c' does not name a type

  for(int c=0;c<20;c++)

              ^

sketch_mar25a:32:19: error: 'c' does not name a type

  for(int c=0;c<20;c++)

                   ^

sketch_mar25a:42:3: error: expected unqualified-id before ')' token

   )

   ^

exit status 1
variable or field 'setup' declared void

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

PaulS

Quote
BUT THESE ERRORS ARE still showing up..
Then the code you didn't post is NOT ALL CORRECT.

Where IS your code?
The art of getting good answers lies in asking good questions.

GypsumFantastic

Show us the sketch code. Remember to use [code][/code] tags.

david_2018

I would suspect something prior to the first error on line 10.  Probably a simple typing error or you left something off, like a bracket or semicolon.  Most of the other errors messages are just a consequence of the initial error.

neiklot

Look carefully at the line for setup which should be like this:

Code: [Select]
void setup()
{


... or this:

Code: [Select]
void setup() {

It's complaining about it here:

Code: [Select]
sketch_mar25a:10:3: error: variable or field 'setup' declared void

... but I tried a few common mistakes and can't get your error, alas.

edit, or you may have an imperfectly formed include or define or something above setup().



Go Up