Go Down

Topic: Problema declarar puertos en arduino Due (Read 77 times) previous topic - next topic

Quisiera saber si alguien me puede ayudar con mi programa el cual adjunto aqui, el problema es que no
se la instruccion para declarar los puertos del Arduino Due, primeramente el programa lo realize en el Arduino Mega sin ningun problema, pero ya al pasarlo al Arduino Due me marca varios errores, no se si me puedan hacer el favor de ayudarme a traducir el programa para el Arduino Due programa:

Code: [Select]

byte  sensor;
byte lectura;

byte secuencia1 = B00000110;
byte secuencia2 = B00100100;
byte secuencia3 = B00100001;
byte secuencia4 = B00001001;
byte secuencia5 = B00011000;
byte secuencia6 = B00010010;
int a = 3;

void setup() {
DDRL = B11111111;//DECLARAS bit de puerto L salida
 
DDRC = B11111000;//Declara bit de puerto C entrada

}

void loop() {
 
  sensor = PINC;
  digitalWrite(sensor, BIN);
  lectura = sensor;
 
  if( lectura == B00000101 ){
     for (int i = 0; i <= a; i++) {
     PORTL = secuencia1;
     delay(1);
     }
  }
 
  if( lectura == B00000100 ){
    for (int i = 0; i <= a; i++){
    PORTL = secuencia2;
    delay(1);
    }
  }
 
  if( lectura == B00000110 ){
    for (int i = 0; i <= a; i++){
    PORTL = secuencia3;
    delay(1);
    }
  }

  if( lectura == B00000010 ){
    for (int i = 0; i <= a; i++){
    PORTL = secuencia4;
    delay(1);
    }
  }
 
  if( lectura == B00000011 ){
    for (int i = 0; i <= a; i++){
    PORTL = secuencia5;
    delay(1);
    }
  }
 
  if( lectura == B00000001 ){
    for (int i = 0; i <= a; i++){
    PORTL = secuencia6;
    delay(1);
    }
  }
  }   



este es el error que me aparece

Code: [Select]

Arduino: 1.5.8 (Windows 8), Placa:"Arduino Due (Programming Port)"

sketch_oct25a.ino: In function 'void setup()':
sketch_oct25a.ino:13:1: error: 'DDRL' was not declared in this scope
sketch_oct25a.ino:15:1: error: 'DDRC' was not declared in this scope
sketch_oct25a.ino: In function 'void loop()':
sketch_oct25a.ino:21:12: error: 'PINC' was not declared in this scope
sketch_oct25a.ino:27:6: error: 'PORTL' was not declared in this scope
sketch_oct25a.ino:34:5: error: 'PORTL' was not declared in this scope
sketch_oct25a.ino:41:5: error: 'PORTL' was not declared in this scope
sketch_oct25a.ino:48:5: error: 'PORTL' was not declared in this scope
sketch_oct25a.ino:55:5: error: 'PORTL' was not declared in this scope
sketch_oct25a.ino:62:5: error: 'PORTL' was not declared in this scope
Error de compilación

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



Go Up