Error: 'serial' does not name a type

Hi all
im using arduino uno and L293D(motor driver shield) and this error appears when im verifying could someone help me?

here is code:
#include "L293D.h"
/*
#include <Servo.h>
Servo myservo;
*/

char dataIn='S';
char determinant;
char det;
int vel = 200; //Bluetooth Stuff

int overdrive = 13; //Press Toggle Switch #1, the pin13 LED will light up

void setup()

motor.attach(2, 3, 4, 5);

Serial.begin(9600);md.init();

/*
myservo.attach(6);delay(100);
myservo.write(90);delay(100);
*/

void loop(){ det = check(); // You'll need to reconstruct this if your not using the Pololu Dual VNH5019

 while (det == 'F')   // F, move forward

{
motor.setSpeeds(vel, vel);
det = check();
}

while (det == 'B') // B, move back
{
motor.setSpeeds(-vel, -vel);
det = check();
}

while (det == 'L') // L, move wheels left
{
motor.setSpeeds(-vel, vel);
det = check();
}

while (det == 'R') // R, move wheels right
{
motor.setSpeeds(vel, -vel);
det = check();
}

while (det == 'I') // I, turn right forward
{
motor.setSpeeds(vel, vel / 2);
det = check();
}

while (det == 'J') // J, turn right back
{
motor.setSpeeds(-vel, -vel / 2);
det = check();
}

while (det == 'G') // G, turn left forward
{
motor.setSpeeds(vel / 2, vel);
det = check();
}

while (det == 'H') // H, turn left back
{
motor.setSpeeds(-vel / 2, -vel);
det = check();
}

while (det == 'S') // S, stop
{
motor.setSpeeds(0, 0);
det = check();
}

  //---------------------Toggle switch code------------------//
  /*while (det == 'W'){myservo.write(180);delay(100);det = check();} 
  while (det == 'w'){myservo.write(90);delay(100);det = check();} 
   
  while (det == 'U'){myservo.write(0);delay(100);det = check();} 
  while (det == 'u'){myservo.write(90);delay(100);det = check();} 
  */

}

char check()
{
if (Serial.available() > 0)
{
char dataIn = Serial.read();
return dataIn;
}
else
{
return 'S'; // default to stop if no data received
}
}

here are errors:
C:\Users\User\AppData\Local\Temp.arduinoIDE-unsaved2023229-8236-1w1t94e.qjp1\sketch_mar29a\sketch_mar29a.ino:15:1: error: expected initializer before 'motor'
motor.attach(2, 3, 4, 5);
^~~~~
C:\Users\User\AppData\Local\Temp.arduinoIDE-unsaved2023229-8236-1w1t94e.qjp1\sketch_mar29a\sketch_mar29a.ino:16:1: error: 'Serial' does not name a type
Serial.begin(9600);md.init();
^~~~~~
C:\Users\User\AppData\Local\Temp.arduinoIDE-unsaved2023229-8236-1w1t94e.qjp1\sketch_mar29a\sketch_mar29a.ino:16:20: error: 'md' does not name a type
Serial.begin(9600);md.init();

Where are the curly braces ({})?

Perhaps try the following:

void setup() {
  motor.attach(2, 3, 4, 5);
  Serial.begin(9600);
  md.init();
}

Furthermore, neither motor nor md are defined.

Read the forum guidelines to see how to properly post code and some good information on making a good post.

Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags. Auto-format will show the missing curly brackets of the setup() function.

Please go back and fix your original post.

Please post the entire error message(s). Paraphrasing leaves out important information. Copy the entire error message and paste into a post.

where are motor and md defined?

Where did you get the L293D.h library? Did you run library examples to see how to use the library?

i updated

yes i runned actually. library in arduino ide 2.0.5

oh, right i forgot ill add to code and try again,thanks

yes i forgot to type define,thanks

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.