al momento de compilar me salen estos errores... tengo buscando ya 2 horas y no encuentro nada, son varios errores si pudieran ayudarme.... el programa usa un acelerometro para regular la velocidad de 3 motores.. gracias por su ayuda
at the time of compiling I get these errors ... I have been looking for 2 hours and I can not find anything, they are several errors if they could help me .... the program uses an accelerometer to regulate the speed of 3 engines .. thanks for your help
#include <Adafruit_ADXL345_U.h>
#include <Adafruit_Sensor.h>
#include <Wire.h>
#include <SPI.h>
#include <AFMotor.h>
ADXL345 adxl = ADXL345();
AF_DCMotor Mabajo(1);
AF_DCMotor Marriba(2);
AF_DCMotor Matras(3);
int x,y,z;
int velocidad=0;
int boton=11;
int estado=0;
int const Amax=1200;
void setup() {
Serial.begin(9600);
adxl.powerOn();
adxl.setRangeSetting(16);
Matras.setSpeed(100);
}
void loop() {
adxl.readAccel(&x, &y, &z);
Serial.print(x);
Serial.print(", ");
Serial.print(y);
Serial.print(", ");
Serial.println(z);
if(!digitalRead(boton)){
switch(estado){
case 0:
Encendido();
estado=1;
break;
case 1:
Apagado();
estado=0;
break;
}
}
}
int Helices(){
Mabajo.setSpeed(velocidad);
Marriba.setSpeed(velocidad);
Mabajo.run(FORWARD);
Marriba.run(BACKWARD);
}
int Rotar1(){
Matras.run(FORWARD);
}
int Rotar2(){
Matras.run(BACKWARD);
}
int Encendido(){
while(y<Amax){
velocidad=velocidad+5;
Helices();
}
while(y>=Amax){
Rotar1();
delay(5000);
Rotar2();
delay(5000);
}
}
int Apagado(){
while(y>0){
velocidad=velocidad-5;
Helices();
}
}
errors------------------------------
Arduino:1.8.5 (Windows Store 1.8.10.0) (Windows 10), Tarjeta:"Arduino/Genuino Uno"
Helicoptero:9: error: 'ADXL345' does not name a type
ADXL345 adxl = ADXL345();
^
C:\Users\MANUEL\Downloads\Helicoptero\Helicoptero.ino: In function 'void setup()':
Helicoptero:21: error: 'adxl' was not declared in this scope
adxl.powerOn();
^
C:\Users\MANUEL\Downloads\Helicoptero\Helicoptero.ino: In function 'void loop()':
Helicoptero:27: error: 'adxl' was not declared in this scope
adxl.readAccel(&x, &y, &z);
^
exit status 1
'ADXL345' does not name a type
Este reporte podría tener más información con
"Mostrar salida detallada durante la compilación"
opción habilitada en Archivo -> Preferencias.