Hello Every one :
i have write this code to move my car (North , South , East and West ) but i found stanger Error "Void" dose not a name type, and one of my function not declare but i'm declared it
there is the code:
// Generate Code for 8D control
const int M1_1= 6; // motor driver 1.1
const int M1_2= 7; // motor driver 1.2
const int M2_1= 8; // motor driver 2.1
const int M2_2= 9; // motor driver 2.2
int x;
void setup()
{
Serial.begin(9600);
pinMode(M1_1 ,OUTPUT);
pinMode(M1_2 ,OUTPUT);
pinMode(M2_1 ,OUTPUT);
pinMode(M2_2 , OUTPUT);
}
void()
{
x=Serial.read();
switch(x) {
case 0: // stop
Stop();
break;
case 127: // North
Move_N();
break;
case 255: // South
Move_S();
break;
case 63: // West
Move_Left();
break;
case 191: // East
Move_Right();
break;
case 159: // North-East
Move_NE();
break;
case 223: // South-East
Move_SE();
break;
case 31: // South-West
Move_SW();
break;
case 95: //North-West
Move_NW();
break;
}
}
And this code of functions:
void Stop()
{digitalWrite(M1_1,LOW); digitalWrite(M1_2,LOW); digitalWrite(M2_1,LOW); digitalWrite(M2_2,LOW);}
void Move_N() // Forward
{digitalWrite(M1_1,HIGH); digitalWrite(M1_2,LOW); digitalWrite(M2_1,HIGH); digitalWrite(M2_2,LOW);}
void Move_S() // backward
{digitalWrite(M1_1,HIGH); digitalWrite(M1_2,LOW); digitalWrite(M2_1,HIGH); digitalWrite(M2_2,LOW);}
void Rotate_Right() // Rotate Right
{digitalWrite(M1_1,LOW); digitalWrite(M1_2,HIGH); digitalWrite(M2_1,HIGH); digitalWrite(M2_2,LOW);}
void Rotate_Left() // Rotate left
{digitalWrite(M1_1,HIGH); digitalWrite(M1_2,LOW); digitalWrite(M2_1,LOW); digitalWrite(M2_2,HIGH);}
// __________________________________________________________________________________________________________________________________
void Move_Right()
{ Rotate_Right();
delay(1250);
Move_N();
}
void Move_Left()
{
Rotate_Left();
delay(1250);
Move_N();
}
//______________________________________________________________________________________________________________________________________
void Move_NE()
{
Rotate_Right();
delay(625);
Move_N();
}
void Move_NW()
{
Rotate_Left();
delay(625);
Move_N();
}
//________________________________________________________________________________________________________________________________________
void Move_SE()
{
Rotate_Right();
delay(1875);
Move_N();
}
Void Move_SW()
{
Rotate_Left();
delay(1875);
Move_N();
}
and this is the error:
Final_8D.ino:17:1: error: ‘Void’ does not name a type
Final_8D.ino: In function ‘void loop()’:
Final_8D.ino:57:11: error: ‘Move_SW’ was not declared in this scope
Functions.ino: At global scope:
Functions.ino:59:1: error: ‘Void’ does not name a type
in first time i think it's virus and change my OS to linux but it also dosn't work
can any one help me please it's important case
thanks