Troubles with an int value

hi, i just want to test my program, this was working on a R/C modified truck toy, it has serial comunication with roborealm software, and works so fine, but no more, the response now is bad, so i want to test each state of the six states given in the program, one by one

i try to asign a value from 1 to 6 to an int variabe type, but i cant, in this case im trying to assign the value 2 to the enable integer, and put as a comments the instructions for the serial read, when i disable the serial read, begin the problems, and at the compile time i have this message error : error: expected ')' before '=' token

here is the code:

int ledPin1 = 2; //indicadores de leds motor 1 Avance/retro int ledPin2 = 3; //indicadores de leds motor 2 Izq/der int outputPin1 = 4; // direccion de motor 1 Avance/retro. int outputPin2 = 5; // direccion de motor 1 Avance/retro. int outputPin3 = 6; // direccion de motor 2 Izq/Der int outputPin4 = 7; // direccion de motor 2. Izq/Der int pwmPin1 = 9; // velocidad de motor 1 Avance/retro int pwmPin2 = 10; // velocidad de motor 2 Izq/der int enable; int dir; int towards; byte i;

void setup () { Serial.begin(9600); pinMode(ledPin1, OUTPUT); pinMode(ledPin2, OUTPUT); pinMode(outputPin1, OUTPUT); pinMode(outputPin2, OUTPUT); pinMode(outputPin3, OUTPUT); pinMode(outputPin4, OUTPUT); pinMode(pwmPin1, OUTPUT); pinMode(pwmPin2, OUTPUT); }

void loop() {

/* if (Serial.available() > 0) { //habilita lectura de datod del puerto USB

{ enable = Serial.read(); // el dato leido lo coloca en la variable enable */ }

(enable = 2);

if (enable == '1') // si enable toma el valor de 1 vira a la derecha { digitalWrite (outputPin1, HIGH); digitalWrite (outputPin2, LOW); digitalWrite (ledPin1, HIGH); digitalWrite (pwmPin1, HIGH); delay (100); digitalWrite (ledPin1, LOW); digitalWrite (pwmPin1, LOW); }

if (enable == '2') // vira a la izquierda { digitalWrite (outputPin2, HIGH); digitalWrite (outputPin1, HIGH); digitalWrite (ledPin1, HIGH); digitalWrite (pwmPin1, HIGH); delay (100); digitalWrite (ledPin1, LOW); digitalWrite (pwmPin1, LOW); }

if (enable == '3') { //movimiento recto

digitalWrite (outputPin2, HIGH); digitalWrite (outputPin1, LOW); digitalWrite (ledPin1, LOW); digitalWrite (pwmPin1, LOW); delay (100); } { if (enable == '4') // avance hacia adelante {

digitalWrite (outputPin3, HIGH); digitalWrite (outputPin4, LOW); digitalWrite (ledPin2, HIGH); digitalWrite (pwmPin2, HIGH); delay (100); digitalWrite (ledPin2, LOW); digitalWrite (pwmPin2, LOW); }

if (enable == '5') // Retroceso Motor { digitalWrite (outputPin4, HIGH); digitalWrite (outputPin3, LOW); digitalWrite (ledPin2, HIGH); digitalWrite (pwmPin2, HIGH); delay (100); digitalWrite (ledPin2, LOW); digitalWrite (pwmPin2, LOW); }

if (enable == '6') // Motor Detenido { digitalWrite (outputPin3, HIGH); digitalWrite (outputPin4, LOW); digitalWrite (ledPin2, LOW); digitalWrite (pwmPin2, LOW); delay (100); }

} } }

any help is welcome, thanks Roger Santana cancun mexico

You haven't just disabled the serial read, you've terminated "loop" with a closing brace.

Check for matching "{ }".

void loop() {

/*   if (Serial.available() > 0) {    //habilita lectura de datod del puerto USB
   
    {  enable = Serial.read();    //  el dato leido lo coloca en la variable enable 
*/   }
     ^^ this one should not be outside the comment

(BTW yellow on white is hard to read.)

thank you very much, now it works fine, best regards