Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/11/2011, 12:45
Avatar de snakeeyesz
snakeeyesz
 
Fecha de Ingreso: noviembre-2011
Ubicación: Colombia
Mensajes: 1
Antigüedad: 12 años, 5 meses
Puntos: 0
Pregunta Error Programacion switch (expected unqualified-id before 'switch' )

Hola a todos, estoy haciendo un proyecto sobre un elevador, el elevador emplea dos fines de carrera y un motor

cuando lo voy a compilar me dice que hay un error en la sección del switch (opcion){
Les pido el gran favor de que me digan como solucionar este error

el codigo es el siguiente:
boolean subir;
boolean bajar;
boolean FC1;
boolean FC2;
int opcion;
int botonsubir=6;
int botonbajar=7;
int fincarrera1=8;
int fincarrera2=9;
int motorC1=10;
int motorC2=11;

void setup() {
pinMode (motorC1, OUTPUT);
pinMode (motorC2, OUTPUT);
pinMode (fincarrera1, INPUT);
pinMode (fincarrera2, INPUT);
}
void loop (){
FC1=digitalRead(fincarrera1); if (FC1= HIGH) {opcion=1;}
FC2=digitalRead(fincarrera2); if (FC2= HIGH) {opcion=2;}
subir=digitalRead(botonsubir); if (subir= HIGH) {opcion=3;}
bajar=digitalRead(botonbajar); if (bajar= HIGH) {opcion=4;}
}
switch (opcion){
case opcion 1:
digitalWrite(motorC1, HIGH);
digitalWrite(motorC2, HIGH);
break;
case opcion 2:
digitalWrite(motorC1, HIGH);
digitalWrite(motorC2, HIGH);
break;
case opcion 3:
digitalWrite(motorC1, LOW);
digitalWrite(motorC2, HIGH);
break;
default:
digitalWrite(motorC1, LOW);
digitalWrite(motorC2, LOW);
break;
}


Gracias