This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

  • 3 voto(s) - 2.67 Media
  • 1
  • 2
  • 3
  • 4
  • 5
exit status 1 Error compilando para la tarjeta Arduino/Genuino Uno
#1
Hola mi nombre es francisco, estoy hace poco explorando en este mundo de arduino, programacion, etc y es muy apasionate,
pero en un programación de prueba o aprendizaje , al momento de compilar  me arrojo la siguiente falla:

exit status 1
Error compilando para la tarjeta Arduino/Genuino Uno.

 
he compilado otros programas anteriores  (como prueba, si  ocurre en otros programas) y me compila normal, pero en esta programación , hago uso de condicionales ,tales como el if, while, else. y me produce el error.

 y estoy atrapado en busca del porque, que me falta, sera una libreria?

he pedido ayuda por twitter y no me a ido bien .

las caracteristicas de mi placa es un Arduino uno.
 la version de mi IDE ES 1.8.6.

ojala pueda tener respuesta , para seguir avanzando y aprendiendo por ahora me siento atascado,

saludos.
  Responder
#2
Lo mejor seria que copies y pegues por aqui el codigo, para poder ver cual seria el problema... Saludos
  Responder
#3
Error compilando quiere decir que el IDE no es capaz de traducir lo que tu has escrito a lenguaje máquina. Si estas empezando con condicionales es probable que no hayas cerrado bien algún corchete o que te hayas liado con tanto ( )[ ]}{.

Sino encuentras nada mal, haz caso a Neox y dejanos ver el codigo.
  Responder
#4
Hola amigos ,gracias por tomarse su tiempo y poder ayudar y responder hacia mi falla. Efectivamente es cuando uso las condicionales , he echo don programas simples y ambos me dan error al compilar, compile otros programas que tengo sin las condicionales y compilar normal.

dejare los 2 IDE con uso de condicinales, mientras tanto bajare una version mas antigua para ver si me pasa lo mismo .


uso condicional if_else

void Setup() {
pinMode (2, INPUT); // pin 2 como entrada
pinMode (3, OUTPUT); // pin 3 como salida
}

void loop() {
if (digitalRead(2) == HIGH){ // evaluo si la entrada esta a nivel alto
digitalWrite (3, HIGH); // enciende led
}
else {
digitalWrite(3, LOW); // apaga led
}
}


uso condicional while

int PULSADOR = 2;
int LED = 3;
int ESTADO = LOW;


void Setup(){
pinMode (PULSADOR, INPUT); // pin 2 como entrada
pinMode (LED, OUTPUT);

}

void loop(){
while(digitalRead(PULSADOR) == LOW){

}
ESTADO = digitalRead(LED);
digitalWrite(LED, !ESTADO);
while(digitalRead(PULSADOR) == HIGH){

}
}

saludos y gracias
  Responder
#5
Tu error está en la "S" mayuscula del setup. Debes declarar la función como "void setup()" en lugar de "void Setup()"
El compilador de arduino es sensible al uso de mayusculas y minusculas. Debes tener mucho cuidado con esto, ya que por ejemplo "digitalWrite" te funcionará, pero "digitalwrite" no.


Por cierto, conforme al segundo fragmento de código... por lo que veo has intentado realizar una función en la cual, si pulsas una vez, el led se te enciende, y si pulsas otra vez, se te apaga, y así hasta el infinito. 
Pues bien, ojo con esto, cuando realizas la lectura del estado con"ESTADO = digitalRead(LED);" dependiendo del tipo de micro puede funcionarte o no... es buena practica el declarar otra variable para almacenar una memoria del estado anterior en el que se encontraba el led y utilizarla en lugar de leer el estado de esta manera.

Por ultimo, si aun arreglando esto te suceden cosas raras al presionar el pulsador debes ser consciente de que los pulsadores tienen rebotes, el microcontrolador es tan rapido que puede detectar cuando tu pulsas el boton y los rebotes que se producen al soltarlo. Puedes implementar una solución antirebote mediante hardware (con un pequeño condensador) y mediante software (un pequeño retardo para evitar leer mientras se está produciendo el rebote)
  Responder
#6
hola amigo,

Revise y corregí lo de del setup que tenia con mayúscula. Pero descubrí otra cosa, también tengo una tarjeta arduino leonardo , fui y seleccione la tarjeta leonardo en herramientas, compile y adivina , me arrojo el mismo error , que con la arduino uno,tambien busque otro IDE con una versión anterior a esta v.1.8.4 compile y igual, el mismo dilema.
nose si sera que me falta una librería con las condicionales . se me escapa de las manos.

saludos
  Responder
#7
He copiado y pegado tu primer programa en mi ordenador y efectivamente, me da el mismo error que a ti, hice caso a shellmer y compilado. Supongo que llevarás tiempo pegandote con esto así que he sacado screen para que me creas :p

Ánimo que es mas sencillo de lo que te parece ahora.


[Imagen: Sin_t_tulo.jpg]

Por cierto, dando al primer botón de la barra de herramientas, el IDE solo compila el programa. Da igual que placa de arduino tengas, incluso sin ningún arduino te debería compilar.
  Responder
#8
(24-07-2018, 01:50 AM)fcojavier escribió: fui y seleccione la tarjeta leonardo en herramientas, compile y adivina , me arrojo el mismo error , que con la arduino uno,tambien busque otro IDE con una versión anterior a esta  v.1.8.4 compile y igual, el mismo dilema.  

Deberías fijarte mejor en los mensajes de error. No te centres en el exit status y mira las líneas anteriores. Por ejemplo, en la imagen que ha puesto Nullz el contenido de las 2 primeras líneas es mucho más interesante para localizar la razón del error que las 2 últimas que nos copiaste.

Por otra parte el Arduino te estaba dando otra pista que puedes ver también en la imagen de Nullz. Verás que en la imagen de la izquierda, cuando da error al compilar, el nombre de la función Setup aparece en color negro al contrario de lo que pasa con la función loop. Al cambiar el nombre a setup pasan a mostrarse en el mismo color.

Saludos.
  Responder
#9
hola...tango el mismo problema que ustedes y nose que hacer estoy estancado queria saber si alguien me puede ayudar, aquí le mando mi código para que lo revise.
// SOUL DANY.
// CARRO CONTROLADO POR VIA BLUETOOTH.
// SUSCRIBETE A MI CANAL SI TE HA SERVIDO Y DEJA TU BUEN LIKE.
// EN ESTA PROGRAMACION CONSTA DECIR QUE NO HAY NINGUN PROBLEMA DE TENER EL BLUETOOTH CONECTADO AL ARDUINO.

#include <SoftwareSerial.h>
#include <Servo.h>

// CONEXIONES PARA EL BLUETOOTH.

int bluetoothTx = 2;
int bluetoothRx = 3;

SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);

// MOTOR 1.

int Motor1A = 5;
int Motor1B = 6;

// MOTOR 2.

int Motor2A = 9;
int Motor2B = 10;

void setup ()
{
bluetooth.begin(115200);
bluetooth.print("$$$");
delay(100);
bluetooth.println("U,9600,N");
bluetooth.begin(9600);

pinMode( Motor1A, OUTPUT );
pinMode( Motor2A, OUTPUT );
pinMode( Motor1B, OUTPUT );
pinMode( Motor2B, OUTPUT );

digitalWrite( Motor1A, LOW );
digitalWrite( Motor2A, LOW );
digitalWrite( Motor1B, LOW );
digitalWrite( Motor2B, LOW );
}

int flag1 = -1;
int flag2 = -1;

void loop()
{
if(bluetooth.available())
{
char toSend = (char)bluetooth.read();
if(toSend == 'S')
{
  
flag1 = 0;
flag2 = 0;

digitalWrite( Motor1A, LOW);
analogWrite( Motor1B, LOW);

digitalWrite( Motor2A, LOW),
analogWrite( Motor2B, LOW);

}
if( toSend == 'F' || toSend == 'G' || toSend == 'I')
{
if (flag1 != 1)
{
// ESTOS HARAN QUE VAYA PARA ADELANTE EL CARRITO.
flag1 = 1;
digitalWrite( Motor1A, HIGH);
analogWrite( Motor1B, 0 );
digitalWrite( Motor2A, HIGH);
analogWrite( Motor2B, 0 );
}
}
if(toSend == 'B' || toSend == 'H' || toSend == 'J')
{
if(flag1 != 2)
{
// ESTOS HARAN LA REVERSA DEL CARRITO.
flag1 = 2;
digitalWrite( Motor1B, HIGH);
analogWrite( Motor1A, 0 );
digitalWrite( Motor2B, HIGH);
analogWrite( Motor2A, 0 );
}
}
if(toSend == 'L' || toSend == 'G' || toSend == 'H')
{
if(flag2 != 1)
{
// ESTOS HARAN QUE GIRE HACIA LA IZQUIERDA.
flag2 = 1;
digitalWrite( Motor2B, HIGH);
analogWrite( Motor2A, 0 );
digitalWrite( Motor1A, HIGH);
analogWrite( Motor1B, 0 );
}
}
else
if(toSend == 'R' || toSend == 'I' || toSend == 'J')
{
if(flag2 != 2)
{
// ESTOS HARAN QUE GIRE HACIA LA DERECHA.
flag2 = 2;
digitalWrite( Motor1B, HIGH);
analogWrite( Motor1A, 0 );
digitalWrite( Motor2A, HIGH);
analogWrite( Motor2B, 0 );
}
}
else
{
if(flag2 != 3) 
{
// SI TU SABES PARA QUE SIRVE ESTO DIME POR QUE SE LO PUSO UN AMIGO Y NI IDEA.
flag2 = 3;
digitalWrite ( Motor2A, LOW);
analogWrite ( Motor2B, LOW);  
digitalWrite ( Motor2B, LOW);
analogWrite ( Motor2A, LOW);  
}
}
}
}
  Responder
#10
hola tengo el mismo problema de usted no se cual es el error en el siguiente codigo:
#include <LcdKeypad.h>
#include <Wire.h>
#include <Servo.h>
#include <Password.h> //Incluimos la libreria Password
#include <Keypad.h> //Incluimos la libreria Keypad
#define RELAY1  11     // se definen los pines donde se conectaran los reles


int pos = 180;// variable to store the servo position

Servo myservo;


Password password = Password("4015");  //Definimos el Password
int dlugosc = 4;                        //Largo del Password
 
LiquidCrystal_I2C lcd (0x27, 16, 2);
 
int buzzer = 10; //Creamos las Variables de salida
int ledRed = 12; 
int ledGreen = 13;
 
int ilosc; //Numero de Clicks
 
const byte ROWS = 4; // Cuatro Filas
const byte COLS = 4; // Cuatro Columnas

// Definimos el Keymap
char keys[ROWS][COLS] = {
  {'1','2','3','A'},
  {'4','5','6','B'},
  {'7','8','9','C'},
  {'*','0','#','D'}
};

byte rowPins[ROWS] = { 7,6,5,4 };// Conectar los keypads ROW1, ROW2, ROW3 y ROW4 a esos Pines de Arduino.
byte colPins[COLS] = { 3,2,1,0 };// Conectar los keypads COL1, COL2, COL3 y COL4 a esos Pines de Arduino.
 
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
 
void setup()
{
  myservo.attach(A0 );
  Serial.begin(9600);
  keypad.addEventListener(keypadEvent);  
  pinMode(RELAY1, OUTPUT); 
  pinMode(ledRed, OUTPUT);  
  pinMode(ledGreen, OUTPUT);
  pinMode(buzzer, OUTPUT);
 
  digitalWrite(ledRed, HIGH);
  digitalWrite(ledGreen, LOW);
  Wire.begin();
  lcd.begin(16, 2);
  lcd.clear();
  lcd.backlight();
  lcd.setCursor(0,0);
  lcd.print("  #SLAYERFOX#");
  lcd.setCursor(0,1);
  lcd.print("FAVOR ENTRE PIN");
  //lcd.noBacklight();
}
 
void loop()
{
  keypad.getKey();
}
void keypadEvent(KeypadEvent eKey)
{
  switch (keypad.getState())
  {
    case PRESSED:
   
int i;
for( i = 1; i <= 1; i++ )
{
  digitalWrite(buzzer, HIGH);  
  delay(200);            
  digitalWrite(buzzer, LOW);  
  delay(100);      
}    
 
Serial.print("Pressed: ");
Serial.println(eKey);
 
switch (eKey)
{
/*
case '#':
break;
 
case '*':
break;
*/
 
default:
ilosc=ilosc+1;
password.append(eKey);
}
//Serial.println(ilosc);
 
if(ilosc == 1)
{
lcd.clear();
lcd.setCursor(1,0);
lcd.print("   < PIN >");
lcd.setCursor(0,1);
lcd.print("*_");
}
if(ilosc == 2)
{
lcd.clear();
lcd.setCursor(1,0);
lcd.print("   < PIN >");
lcd.setCursor(0,1);
lcd.print("**_");
}
if(ilosc == 3)
{
lcd.clear();
lcd.setCursor(1,0);
lcd.print("   < PIN >");
lcd.setCursor(0,1);
lcd.print("***_");
}
if(ilosc == 4)
{
lcd.clear();
lcd.setCursor(1,0);
lcd.print("   < PIN >");
lcd.setCursor(0,1);
lcd.print("****_");
}
if(ilosc == 5)
{
lcd.clear();
lcd.setCursor(1,0);
lcd.print("   < PIN >");
lcd.setCursor(0,1);
lcd.print("*****_");
}
if(ilosc == 6)
{
lcd.clear();
lcd.setCursor(1,0);
lcd.print("   < PIN >");
lcd.setCursor(0,1);
lcd.print("******_");
}
if(ilosc == 7)
{
lcd.clear();
lcd.setCursor(1,0);
lcd.print("   < PIN >");
lcd.setCursor(0,1);
lcd.print("*******_");
}
if(ilosc == 8)
{
lcd.clear();
lcd.setCursor(1,0);
lcd.print("   < PIN >");
lcd.setCursor(0,1);
lcd.print("********");
}
 
if(ilosc == dlugosc)
{
delay(250);
checkPassword();
ilosc = 0;
}
}
}
 
void checkPassword()
{
  if (password.evaluate())
  {
int i;
for( i = 1; i <= 3; i++ )
{
  digitalWrite(buzzer, HIGH);  
  delay(120);            
  digitalWrite(buzzer, LOW);  
  delay(70);      
}    
    ilosc = 0;
    password.reset();
    
    Serial.println("Correcto");    
 
    digitalWrite(ledRed, LOW);
    digitalWrite(ledGreen, HIGH);
 
    lcd.clear();
    lcd.setCursor(0,1);
    lcd.print("<<PIN CORRECTO>>");    
 
    delay(2000);
    digitalWrite(ledGreen, LOW);
    digitalWrite(ledRed, HIGH);    
       
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("  #SLAYERFOX#");
    lcd.setCursor(0,1);
    lcd.print("FAVOR ENTRE PIN");   
   
   digitalWrite(RELAY1,HIGH);          // Se apaga el relay 1


  for (pos = 180; pos >= 113; pos -= 1) 
      {
      myservo.write(pos);
   
      delay(3);
       
     

    
  }
  delay(10000);
   digitalWrite(RELAY1,LOW);
   
      {
 
   delay(7500);
   for (pos = 113; pos <=180  ; pos += 1) 
      {
      myservo.write(pos);
      delay(3);

      }

  }

}   else{  // Mensaje al introducir contraseña incorrecta 
  {
int i;
for( i = 1; i <= 1; i++ )
{
  digitalWrite(buzzer, HIGH);  
  delay(300);            
  digitalWrite(buzzer, LOW);  
  delay(100);      
}  
    ilosc = 0;  
    password.reset();
 
    Serial.println("Error");
 
    digitalWrite(ledGreen, LOW);
    digitalWrite(ledRed, HIGH);    
             
    lcd.clear();
    lcd.setCursor(0,1);
    lcd.print("<<PIN ERRONEO>>");
    delay(2000);
   
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print("  *SLAYERFOX*");
    lcd.setCursor(0,1);
    lcd.print("FAVOR ENTRE PIN");    
  }

 }

me sale este error:

  }Arduino:1.8.9 (Windows 10), Tarjeta:"Arduino/Genuino Uno"

C:\Users\ELIANA MANCIPE\Documents\Arduino\libraries\arduino-display-lcdkeypad\LcdKeypad.cpp:10:19: fatal error: Timer.h: No such file or directory

compilation terminated.

exit status 1
Error compilando para la tarjeta Arduino/Genuino Uno.

Este informe podría contener más información con
"Mostrar salida detallada durante la compilación"
opción habilitada en Archivo -> Preferencias.
  Responder
#11
xit status 1

Error compilando para la tarjeta Arduino/Genuino Uno.

La solucion en mi caso fue instalar la version 2.5.0 de las tarjetas esp8266.

Resulta que tenia dos maquinas virtuales una con la version 2.7.2 y otra con la 2.5.0 y el  mismo programa en una compilaba y en otra daba error para la tarjeta wemos. Fue cambiar a la version 2.5.0 y solucionado.



[Imagen: esp.jpg]
  Responder
#12
Buenas tardes
Siento discrepar contigo vmlf123, los errores no tienen nada que ver con lo que estas proponiendo, por ejemplo a mi el programa de Edmundo, si me compila sin problemas, pero sin embargo el programa de andreyjaja, no me compila, y el error que me da, es porque me falta la biblioteca
#include <Password.h>
No se de donde la ha sacado, pero no esta en la lista del IDE de Arduino, por lo tanto tendré que buscarla en otra parte.
También me falta la biblioteca
#include <LcdKeypad.h>
Una vez instaladas estas dos bibliotecas, me da el mismo error que a andreyjaja, y es porque alguna de las bibliotecas utilizadas en el programa, hace referencia a la biblioteca
timer.h
Una vez instaladas las bibliotecas, ya no me da el error de timer.h, pero sigue dando errores
En su linea 17
LiquidCrystal_I2C lcd (0x27, 16, 2);
Esta generando un objeto para una librería que no tiene incluida
Por lo que tiene que incluir la librería
#include <LiquidCrystal_I2C.h>
En vez de como tiene la librería
#include <LiquidCrystal.h>
Y me sigue dando errores de compilación porque no me admite la linea 57
lcd.Backlight();
Porque backlight se escribe con minúsculas

Y a demás le falta cerrar la llave cuando termina la función
void checkPassword()
Abre la llave en la linea 178, pero después no la cierra, y el void se queda abierto

Ahora si me compila

Por lo tanto, varios errores de falta de biblioteca, y varios errores de escritura de programación, rara vez se arreglan actualizando una tarjeta
  Responder
#13
muy buenas noches, amigos estoy en esto del arduino desde hace poco, tengo un programa que al compilar me muestra errores, le agradezco de antemano si me pueden echar una manito.

#include "I2Cdev.h"
#include "MPU6050_6Axis_MotionApps20.h"

#define rightMotorF 6
#define rightMotorB 7
#define rightMotorPWM 5
#define leftMotorF 8
#define leftMotorB 9
#define leftMotorPWM 10
#define stby 6
#define INTERRUPT_PIN 2 // use pin 2 on Arduino Uno & most boards

MPU6050 mpu;

Quaternion q; // [w, x, y, z] quaternion container
VectorFloat gravity; // [x, y, z] gravity vector
float ypr[3]; // [yaw, pitch, roll] yaw/pitch/roll container and gravity vector

double kp = 60;
double kd = 2.2;
double ki = 270;

float error;
float integral;
float derivative;
float lastError;

void setup() {
Wire.begin();
Wire.setClock(400000); // 400kHz I2C clock. Comment this line if having compilation difficulties
Serial.begin(115200);
while (!Serial); // wait for Leonardo enumeration, others continue immediately

mpu.dmpGetYawPitchRoll(ypr, &q, &gravity);
Serial.print("ypr\t");
Serial.print(ypr[0] * 180/M_PI);
Serial.print("\t");
Serial.print(ypr[1] * 180/M_PI);
Serial.print("\t");
Serial.print(ypr[2] * 180/M_PI);
Serial.print("\t");
float error = float(ypr[1] * 180/M_PI) - 27; // PID Start
integral = error;
derivative = error - lastError;

int power_difference = kp * error + ki * integral + kd * derivative;
lastError = error;
const int maximum = 200;
if (power_difference > maximum){
power_difference = maximum;
}
if (power_difference < -maximum){
power_difference = -maximum;
Serial.print(power_difference);
Serial.println("");
}
if (power_difference >0) {
digitalWrite(rightMotorF, LOW);
digitalWrite(rightMotorB, HIGH);
analogWrite(rightMotorPWM, power_difference);
digitalWrite(leftMotorF, LOW);
digitalWrite(leftMotorB, HIGH);
analogWrite(leftMotorPWM, power_difference);
digitalWrite(stby, HIGH);
}
else {
digitalWrite(rightMotorF, HIGH);
digitalWrite(rightMotorB, LOW);
analogWrite(rightMotorPWM, -power_difference);
digitalWrite(leftMotorF, HIGH);
digitalWrite(leftMotorB, LOW);
analogWrite(leftMotorPWM, -power_difference);
digitalWrite(stby, HIGH);
}
}

muy buenas noches, amigos estoy en esto del arduino desde hace poco, tengo un programa que al compilar me muestra errores, le agradezco de antemano si me pueden echar una manito.

#include "I2Cdev.h"
#include "MPU6050_6Axis_MotionApps20.h"

#define rightMotorF 6
#define rightMotorB 7
#define rightMotorPWM 5
#define leftMotorF 8
#define leftMotorB 9
#define leftMotorPWM 10
#define stby 6
#define INTERRUPT_PIN 2 // use pin 2 on Arduino Uno & most boards

MPU6050 mpu;

Quaternion q; // [w, x, y, z] quaternion container
VectorFloat gravity; // [x, y, z] gravity vector
float ypr[3]; // [yaw, pitch, roll] yaw/pitch/roll container and gravity vector

double kp = 60;
double kd = 2.2;
double ki = 270;

float error;
float integral;
float derivative;
float lastError;

void setup() {
Wire.begin();
Wire.setClock(400000); // 400kHz I2C clock. Comment this line if having compilation difficulties
Serial.begin(115200);
while (!Serial); // wait for Leonardo enumeration, others continue immediately

mpu.dmpGetYawPitchRoll(ypr, &q, &gravity);
Serial.print("ypr\t");
Serial.print(ypr[0] * 180/M_PI);
Serial.print("\t");
Serial.print(ypr[1] * 180/M_PI);
Serial.print("\t");
Serial.print(ypr[2] * 180/M_PI);
Serial.print("\t");
float error = float(ypr[1] * 180/M_PI) - 27; // PID Start
integral = error;
derivative = error - lastError;

int power_difference = kp * error + ki * integral + kd * derivative;
lastError = error;
const int maximum = 200;
if (power_difference > maximum){
power_difference = maximum;
}
if (power_difference < -maximum){
power_difference = -maximum;
Serial.print(power_difference);
Serial.println("");
}
if (power_difference >0) {
digitalWrite(rightMotorF, LOW);
digitalWrite(rightMotorB, HIGH);
analogWrite(rightMotorPWM, power_difference);
digitalWrite(leftMotorF, LOW);
digitalWrite(leftMotorB, HIGH);
analogWrite(leftMotorPWM, power_difference);
digitalWrite(stby, HIGH);
}
else {
digitalWrite(rightMotorF, HIGH);
digitalWrite(rightMotorB, LOW);
analogWrite(rightMotorPWM, -power_difference);
digitalWrite(leftMotorF, HIGH);
digitalWrite(leftMotorB, LOW);
analogWrite(leftMotorPWM, -power_difference);
digitalWrite(stby, HIGH);
}
}
  Responder
#14
Buenas noches
Deberías de explicar un poco tu proyecto para poder saber que pretendes hacer, y después, darte cuenta que la estructura de los programas arduino constan de tres partes principales.

parte 1 definición de variables e inclusión de bibliotecas a utilizar
parte 2 void setup, definiciones de ejecución, solo se ejecuta 1 vez
parte 3 void loop, bucle del programa que se ejecuta constantemente

Y tu solamente tienes 2 partes, la 1 y la 2, te falta la parte 3, mejor dicho, te falta separar la parte 2 de la 3, tienes mezcladas las definiciones de ejecución de la parte 2, con todo lo que quieres que haga el programa en la parte 3.

Por lo tanto el principal problema de tu programa es que no tienes void loop, y así no te va ha compilar el programa nunca.

Otro consejo, deberías investigar un poco mas sobre el giroscopio MPU6050, hay formas mas sencillas de hacerlo trabajar y de recopilar sus datos, te dejo un enlace y un código de ejemplo, y una librería mas sencilla y mejor.

https://www.electronicshub.org/getting-s...o-mpu6050/

Un saludo


.rar   MPU6050.rar (Tamaño: 96.06 KB / Descargas: 63)

.txt   01_MPU6050_Completo.txt (Tamaño: 1.19 KB / Descargas: 58)


Archivos adjuntos
.txt   01_MPU6050_Completo.txt (Tamaño: 1.19 KB / Descargas: 19)
.rar   MPU6050.rar (Tamaño: 96.06 KB / Descargas: 30)
  Responder
#15
me pueden ayudar me sale este error 

C:\Users\LANIX\Documents\Arduino\libraries\LiquidCrystal_V1.2.1-master\I2CIO.cpp:37:10: fatal error: ../Wire/Wire.h: No such file or directory
 #include <../Wire/Wire.h>
          ^~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Error compilando para la tarjeta Arduino Nano.

esta es mi programacion

#include <I2CIO.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>


#include <LCD.h>


#include <Keypad.h>
#include <NewTone.h>
 
#define DEFAULT_PASSWORD "7355608" // default password (must not exceed 16 chars)
#define TIME_BOMB 40 // default countdown time
 
 
#define MAX_PASSWORD_LENGTH 17 // max password length (16 chars) + ('\0'). PLEASE NOT MODIFY!!!
 
#define GREEN_LED_PIN 12
// RED LED PIN -> LED_BUILTIN (13)
 
#define TONE_PIN 9
#define TONE_FREQ 2000
#define TONE_DUR 120
#define KEYTONE_FREQ 3000
 
#define I2C_ADDR 0x27
 
char password[MAX_PASSWORD_LENGTH] = {'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'};
char data[MAX_PASSWORD_LENGTH] = {'\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0'};
 
unsigned long cuMillis, preMillis = 0, tempo = 0;
 
byte index = 0, codepos = 0, pwdLength;
 
char customKey;
 
const byte rows = 4;
const byte cols = 3;
 
char keyMap[rows][cols] = {
    {'1', '2', '3'},
    {'4', '5', '6'},
    {'7', '8', '9'},
    {'*', '0', '#'}
};
 
byte rowPins[rows] = {5, 4, 3, 2};
byte colPins[cols] = {8, 7, 6};
 
Keypad myKeypad = Keypad(makeKeymap(keyMap), rowPins, colPins, rows, cols);
 
LiquidCrystal_I2C lcd(I2C_ADDR, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
 
char keyget() {
 
    char whichKey = myKeypad.getKey(); //define which key is pressed with getKey
 
    if (whichKey != NO_KEY) {
 
        if (whichKey == '*' || whichKey == '#') {
            index = 0;
            lcd.home();
            lcd.print(F("****************"));
            codepos = 0;
            lcd.home();
            whichKey = NO_KEY;
        }
        else {
            codepos++;
            lcd.setCursor((codepos - 1), 0);
            lcd.print(whichKey);
            NewTone(TONE_PIN, KEYTONE_FREQ, TONE_DUR);
        }
 
        if (codepos == pwdLength) {
            lcd.home();
            lcd.print(F("****************"));
            codepos = 0;
            lcd.home();
        }
    }
 
    return whichKey;
}
 
byte setPassword() {
    char key;
    byte count = 0;
 
    lcd.clear();
    lcd.print(F("SET PASSWORD"));
    lcd.setCursor(0, 1);
 
    while (count < (MAX_PASSWORD_LENGTH - 1)) {
 
        key = myKeypad.getKey();
 
        if (key != NO_KEY) {
 
            if (key == '#') {
 
                if (count == 0) {
                    strncpy(password, DEFAULT_PASSWORD, sizeof(DEFAULT_PASSWORD));
                }
 
                break;
            }
 
            if (key == '*') {
                lcd.setCursor(0, 1);
                lcd.print(F("                "));
 
                for (byte i = 0; i < MAX_PASSWORD_LENGTH; i++) {
                    password[i] = '\0';
                }
 
                count = 0;
            }
            else {
                lcd.setCursor(count, 1);
                lcd.print(key);
                password[count] = key;
                NewTone(TONE_PIN, KEYTONE_FREQ, TONE_DUR);
                count++;
            }
        }
 
        while (count == (MAX_PASSWORD_LENGTH - 1)) {
 
            key = myKeypad.getKey();
 
            if (key != NO_KEY) {
 
                if (key == '#') {
                    break;
                }
 
                if (key == '*') {
                    lcd.setCursor(0, 1);
                    lcd.print(F("                "));
 
                    for (byte i = 0; i < MAX_PASSWORD_LENGTH; i++) {
                        password[i] = '\0';
                    }
 
                    count = 0;
                }
            }
        }
    }
 
    return (strlen(password));
}
 
void setTime() {
    char key;
    byte count = 0;
 
    lcd.clear();
    lcd.print(F("SET TIME (secs)"));
    lcd.setCursor(0, 1);
 
    while (count < 5) {
 
        key = myKeypad.getKey();
 
        if (key != NO_KEY) {
 
            if (key == '#') {
 
                if (count == 0) {
                    tempo = TIME_BOMB;
                }
 
                break;
            }
 
            if (key == '*') {
                lcd.setCursor(0, 1);
                lcd.print(F("     "));
 
                tempo = 0;
                count = 0;
            }
            else {
                lcd.setCursor(count, 1);
                lcd.print(key);
                NewTone(TONE_PIN, KEYTONE_FREQ, TONE_DUR);
                tempo = (tempo * 10) + key - '0';
                count++;
            }
        }
 
        while (count == 5) {
 
            key = myKeypad.getKey();
 
            if (key != NO_KEY) {
 
                if (key == '#') {
                    break;
                }
 
                if (key == '*') {
                    lcd.setCursor(0, 1);
                    lcd.print(F("     "));
 
                    tempo = 0;
                    count = 0;
                }
            }
        }
    }
}
 
void countdown(unsigned int timesincestart) {
 
    unsigned long timeleft, currentMillis, previousMillis = 0;
    unsigned int count = TIME_BOMB, interval = 1000;
    char whichKey;
 
    digitalWrite(GREEN_LED_PIN, LOW);
 
    lcd.clear();
    lcd.print(F("****************"));
    lcd.setCursor(0, 1);
    lcd.print(F("BOMB ARMED "));
 
    while (count > 0) {
 
        whichKey = keyget();
 
        if (whichKey != NO_KEY) {
 
            data[index] = whichKey;
            index++;
 
            if (index == pwdLength) {
                index = 0;
                if(strcmp(data, password) == 0) {
                    lcd.print(F(" BOMB DISARMED  "));
                    lcd.setCursor(0, 1);
                    lcd.print(F("    CT'S WIN    "));
                    digitalWrite(LED_BUILTIN, LOW);
                    while (1);
                }
            }
        }
 
        lcd.setCursor(11, 1);
        timeleft = tempo - (millis() / 1000 - timesincestart);
        lcd.print(timeleft);
 
        switch (timeleft) {
            case 9999:
                lcd.setCursor(15, 1);
                lcd.print(" ");
                break;
 
            case 999:
                lcd.setCursor(14, 1);
                lcd.print(" ");
                break;
 
            case 99:
                lcd.setCursor(13, 1);
                lcd.print(" ");
                break;
 
            case 25:
                interval = 800;
                break;
 
            case 15:
                interval = 600;
                break;
 
            case 9:
                lcd.setCursor(12, 1);
                lcd.print(" ");
                interval = 400;
                break;
 
            case 6:
                interval = 200;
                break;
 
            case 3:
                interval = 150;
                break;
 
            default:
                break;
        }
 
        currentMillis = millis();
 
        if (currentMillis - previousMillis >= interval) {
 
            previousMillis = currentMillis;
 
            digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
            NewTone(TONE_PIN, TONE_FREQ, TONE_DUR);
        }
 
        if (timeleft <= 0) {
            digitalWrite(LED_BUILTIN, LOW);
            digitalWrite(GREEN_LED_PIN, HIGH);
            delay(400);
            for (byte i = 0; i < 15; i++) {
                NewTone(TONE_PIN, TONE_FREQ, (TONE_DUR / 2));
                delay((TONE_DUR / 2) * 1.30);
            }
            lcd.home();
            lcd.print(F("TERRORISTS WIN  "));
            lcd.setCursor(0, 1);
            lcd.print(F("BOMB DETONATED  "));
            digitalWrite(GREEN_LED_PIN, LOW);
            digitalWrite(LED_BUILTIN, HIGH);
            while (1);
        }
    }
 
    return;
}
 
void setup() {
 
    pinMode(GREEN_LED_PIN, OUTPUT);
    pinMode(LED_BUILTIN, OUTPUT);
    digitalWrite(GREEN_LED_PIN, LOW);
    digitalWrite(LED_BUILTIN, LOW);
 
    lcd.begin(16, 2);
    lcd.setBacklight(HIGH);
 
    setTime();
    pwdLength = setPassword();
 
    lcd.clear();
    lcd.print(F("****************"));
}
 
void loop() {
 
    customKey = keyget();
 
    if (customKey != NO_KEY) {
        data[index] = customKey;
        index++;
 
        if (index == pwdLength) {
            index = 0;
            if (strcmp(data, password) == 0) {
 
                countdown(millis() / 1000);
            }
        }
    }
 
    cuMillis = millis();
 
    if (cuMillis - preMillis >= 1500) {
        preMillis = cuMillis;
        digitalWrite(GREEN_LED_PIN, !digitalRead(GREEN_LED_PIN));
    }
}
  Responder
#16
(23-07-2018, 06:20 AM)neoxM3 escribió: Lo mejor seria que copies y pegues por aqui el codigo,  para poder ver cual seria el problema...  Saludos
Hola, soy nuevo tambien en arduino uno; otras librerias me funcionan, ahora estoy probando el siguiente codigo y me sale el error descrito arriba: es un codigo copiado por que no se mucho de arduino: gracias


/*
This is an example on how to use the 1.8" TFT 128x160 SPI ST7735 display using the Adafruit library.

ST7735 TFT SPI display pins for Arduino Uno/Nano:
 * LED =   3.3V
 * SCK =   13
 * SDA =   11
 * A0 =    8
 * RESET = 9
 * CS =    10
 * GND =   GND
 * VCC =   5V

Another version marked as KMR-1.8 SPI:
This version only supports 3.3V logic so put a level shifter for all I/O pins, or a 2.2k resistor between
the display and arduino, and a 3.3k resistor to ground to create a simple voltage divider to produce a 3V output.
 * LED- =  GND
 * LED+ =  15Ω resistor to 5V
 * CS =    10
 * SCL =   13
 * SDA =   11
 * A0  =   8
 * RESET = 9
 * VCC =   5V or 3.3V (the display has it's own 3.3V regulator)
 * GND =   GND

Hardware SPI Pins:
 * Arduino Uno   SCK=13, SDA=11
 * Arduino Nano  SCK=13, SDA=11
 * Arduino Due   SCK=76, SDA=75
 * Arduino Mega  SCK=52, SDA=51

SPI pin names can be confusing. These are the alternative names for the SPI pins:
MOSI = DIN = R/W = SDO = DI = SI = MTSR = SDA = D1 = SDI
CS = CE = RS = SS
DC = A0 = DO = DOUT = SO = MRST
RESET = RST
SCLK = CLK = E = SCK = SCL = D0


Libraries needed:
https://github.com/adafruit/Adafruit-ST7735-Library
https://github.com/adafruit/Adafruit-GFX-Library


Reference page for GFX Library: https://cdn-learn.adafruit.com/downloads...ibrary.pdf


Color is expressed in 16 bit with Hexadecimal value.
To select a particular color, go here and copy the "Hexadecimal 16 bit color depth value":
https://ee-programming-notepad.blogspot....icker.html

Common colors:
 * BLACK    0x0000
 * BLUE     0x001F
 * RED      0xF800
 * GREEN    0x07E0
 * CYAN     0x07FF
 * MAGENTA  0xF81F
 * YELLOW   0xFFE0
 * WHITE    0xFFFF

A way to select a color is to write: "ST7735_BLACK", or "ST7735_BLUE", etc.
Or just write the code for the color. Either way, it works.


List of custom fonts: https://learn.adafruit.com/adafruit-gfx-...sing-fonts

Note about custom font:
 * Text background color is not supported for custom fonts. For these reason you would need to draw a filled 
   rectangle before drawing the text. But this would cause the text to flicker, so I don't recommend using custom fonts
   for components that refresh continuously.
 * Using custom fonts slows down the arduino loop, so the refresh rate is lesser than using the standard font.


Sketch made by: InterlinkKnight
Last modification: 01/11/2018
*/



#include <Adafruit_GFX.h>  // Include core graphics library
#include <Adafruit_ST7735.h>  // Include Adafruit_ST7735 library to drive the display


// Declare pins for the display:
#define TFT_CS     10
#define TFT_RST    9  // You can also connect this to the Arduino reset in which case, set this #define pin to -1!
#define TFT_DC     8
// The rest of the pins are pre-selected as the default hardware SPI for Arduino Uno (SCK = 13 and SDA = 11)


// Create display:
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);



//#include <Fonts/FreeSerif18pt7b.h>  // Add a custom font





int Variable1;  // Create a variable to have something dynamic to show on the display






void setup()  // Start of setup
{

  // Display setup:

  // Use this initializer if you're using a 1.8" TFT
  tft.initR(INITR_BLACKTAB);  // Initialize a ST7735S chip, black tab

  tft.fillScreen(ST7735_BLACK);  // Fill screen with black

  //tft.setRotation(0);  // Set orientation of the display. Values are from 0 to 3. If not declared, orientation would be 0,
                         // which is portrait mode.

  tft.setTextWrap(false);  // By default, long lines of text are set to automatically “wrap” back to the leftmost column.
                           // To override this behavior (so text will run off the right side of the display - useful for
                           // scrolling marquee effects), use setTextWrap(false). The normal wrapping behavior is restored
                           // with setTextWrap(true).




  // We are going to print on the display everything that is static on the setup, to leave the loop free for dynamic elements:

  // Write to the display the text "Hello":
  tft.setCursor(0, 0);  // Set position (x,y)
  tft.setTextColor(ST7735_WHITE);  // Set color of text. First is the color of text and after is color of background
  tft.setTextSize(3);  // Set text size. Goes from 0 (the smallest) to 20 (very big)
  tft.println("Hello");  // Print a text or value

  
  
  // Start using a custom font:
  //tft.setFont(&FreeSerif18pt7b);  // Set a custom font
  tft.setTextSize(0);  // Set text size. We are using custom font so you should always set text size as 0

  // Write to the display the text "World":
  tft.setCursor(0, 50);  // Set position (x,y)
  tft.setTextColor(ST7735_RED);  // Set color of text. We are using custom font so there is no background color supported
  tft.println("World!");  // Print a text or value

  // Stop using a custom font:
  //tft.setFont();  // Reset to standard font, to stop using any custom font previously set




  // Draw rectangle:
  tft.drawRect(0, 60, 60, 30, ST7735_CYAN);  // Draw rectangle (x,y,width,height,color)
                                             // It draws from the location to down-right
                                             
  // Draw rounded rectangle:
  tft.drawRoundRect(68, 60, 60, 30, 10, ST7735_CYAN);  // Draw rounded rectangle (x,y,width,height,radius,color)
                                                       // It draws from the location to down-right


  // Draw triangle:
  tft.drawTriangle(60,120,    70,94,    80,120, ST7735_YELLOW);  // Draw triangle (x0,y0,x1,y1,x2,y2,color)


  // Draw filled triangle:
  tft.fillTriangle(100,120,    110,94,    120,120, ST7735_CYAN);  // Draw filled triangle (x0,y0,x1,y1,x2,y2,color)


  // Draw line:
  tft.drawLine(0, 125, 127, 125, ST7735_CYAN);  // Draw line (x0,y0,x1,y1,color)
  

  //  Draw circle:
  tft.drawCircle(15, 144, 14, ST7735_GREEN);  //  Draw circle (x,y,radius,color)


  // Draw a filled circle:
  tft.fillCircle(60, 144, 14, ST7735_BLUE);  // Draw circle (x,y,radius,color)


  // Draw rounded rectangle and fill:
  tft.fillRoundRect(88, 130, 40, 27, 5, 0xF81B);  // Draw rounded filled rectangle (x,y,width,height,color)
  
}  // End of setup







void loop()  // Start of loop
{

  Variable1++;  // Increase variable by 1
  if(Variable1 > 150)  // If Variable1 is greater than 150
  {
    Variable1 = 0;  // Set Variable1 to 0
  }


  // Convert Variable1 into a string, so we can change the text alignment to the right:
  // It can be also used to add or remove decimal numbers.
  char string[10];  // Create a character array of 10 characters
  // Convert float to a string:
  dtostrf(Variable1, 3, 0, string);  // (<variable>,<amount of digits we are going to use>,<amount of decimal digits>,<string name>)







  // We are going to print on the display everything that is dynamic on the loop, to refresh continuously:

  // Write to the display the Variable1 with left text alignment:
  tft.setCursor(13, 67);  // Set position (x,y)
  tft.setTextColor(ST7735_YELLOW, ST7735_BLACK);  // Set color of text. First is the color of text and after is color of background
  tft.setTextSize(2);  // Set text size. Goes from 0 (the smallest) to 20 (very big)
  tft.println(Variable1);  // Print a text or value
  
  // There is a problem when we go, for example, from 100 to 99 because it doesn't automatically write a background on
  // the last digit we are not longer refreshing. We need to check how many digits are and fill the space remaining.
  if(Variable1 < 10)  // If Variable1 is less than 10...
  {
    // Fill the other digit with background color:
    tft.fillRect(23, 67, 12, 18, ST7735_BLACK);  // Draw filled rectangle (x,y,width,height,color)
  }
  if(Variable1 < 100)  // If Variable1 is less than 100...
  {
    // Fill the other digit with background color:
    tft.fillRect(36, 67, 12, 18, ST7735_BLACK);  // Draw filled rectangle (x,y,width,height,color)
  }




  // Write to the display the string with right text alignment:
  tft.setCursor(81, 67);  // Set position (x,y)
  tft.setTextColor(ST7735_GREEN, ST7735_BLACK);  // Set color of text. First is the color of text and after is color of background
  tft.setTextSize(2);  // Set text size. Goes from 0 (the smallest) to 20 (very big)
  tft.println(string);  // Print a text or value








  // We are going to write the Variable1 with a custom text, so you can see the issues:
  
  // Draw a black square in the background to "clear" the previous text:
  // This is because we are going to use a custom font, and that doesn't support brackground color.
  // We are basically printing our own background. This will cause flickering, though.
  tft.fillRect(0, 90, 55, 34, ST7735_BLACK);  // Draw filled rectangle (x,y,width,height,color)




  // Start using a custom font:
  //tft.setFont(&FreeSerif18pt7b);  // Set a custom font
  tft.setTextSize(0);  // Set text size. We are using custom font so you should always set text size as 0

  // Write to the display the Variable1:
  tft.setCursor(0, 120);  // Set position (x,y)
  tft.setTextColor(ST7735_MAGENTA);  // Set color of text. We are using custom font so there is no background color supported
  tft.println(Variable1);  // Print a text or value

  // Stop using a custom font:
 // tft.setFont();  // Reset to standard font, to stop using any custom font previously set





}  // End of loop

(23-07-2018, 06:20 AM)neoxM3 escribió: Lo mejor seria que copies y pegues por aqui el codigo,  para poder ver cual seria el problema...  Saludos
/*
This is an example on how to use the 1.8" TFT 128x160 SPI ST7735 display using the Adafruit library.

ST7735 TFT SPI display pins for Arduino Uno/Nano:
 * LED =   3.3V
 * SCK =   13
 * SDA =   11
 * A0 =    8
 * RESET = 9
 * CS =    10
 * GND =   GND
 * VCC =   5V

Another version marked as KMR-1.8 SPI:
This version only supports 3.3V logic so put a level shifter for all I/O pins, or a 2.2k resistor between
the display and arduino, and a 3.3k resistor to ground to create a simple voltage divider to produce a 3V output.
 * LED- =  GND
 * LED+ =  15Ω resistor to 5V
 * CS =    10
 * SCL =   13
 * SDA =   11
 * A0  =   8
 * RESET = 9
 * VCC =   5V or 3.3V (the display has it's own 3.3V regulator)
 * GND =   GND

Hardware SPI Pins:
 * Arduino Uno   SCK=13, SDA=11
 * Arduino Nano  SCK=13, SDA=11
 * Arduino Due   SCK=76, SDA=75
 * Arduino Mega  SCK=52, SDA=51

SPI pin names can be confusing. These are the alternative names for the SPI pins:
MOSI = DIN = R/W = SDO = DI = SI = MTSR = SDA = D1 = SDI
CS = CE = RS = SS
DC = A0 = DO = DOUT = SO = MRST
RESET = RST
SCLK = CLK = E = SCK = SCL = D0


Libraries needed:
https://github.com/adafruit/Adafruit-ST7735-Library
https://github.com/adafruit/Adafruit-GFX-Library


Reference page for GFX Library: https://cdn-learn.adafruit.com/downloads...ibrary.pdf


Color is expressed in 16 bit with Hexadecimal value.
To select a particular color, go here and copy the "Hexadecimal 16 bit color depth value":
https://ee-programming-notepad.blogspot....icker.html

Common colors:
 * BLACK    0x0000
 * BLUE     0x001F
 * RED      0xF800
 * GREEN    0x07E0
 * CYAN     0x07FF
 * MAGENTA  0xF81F
 * YELLOW   0xFFE0
 * WHITE    0xFFFF

A way to select a color is to write: "ST7735_BLACK", or "ST7735_BLUE", etc.
Or just write the code for the color. Either way, it works.


List of custom fonts: https://learn.adafruit.com/adafruit-gfx-...sing-fonts

Note about custom font:
 * Text background color is not supported for custom fonts. For these reason you would need to draw a filled 
   rectangle before drawing the text. But this would cause the text to flicker, so I don't recommend using custom fonts
   for components that refresh continuously.
 * Using custom fonts slows down the arduino loop, so the refresh rate is lesser than using the standard font.


Sketch made by: InterlinkKnight
Last modification: 01/11/2018
*/



#include <Adafruit_GFX.h>  // Include core graphics library
#include <Adafruit_ST7735.h>  // Include Adafruit_ST7735 library to drive the display


// Declare pins for the display:
#define TFT_CS     10
#define TFT_RST    9  // You can also connect this to the Arduino reset in which case, set this #define pin to -1!
#define TFT_DC     8
// The rest of the pins are pre-selected as the default hardware SPI for Arduino Uno (SCK = 13 and SDA = 11)


// Create display:
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);



//#include <Fonts/FreeSerif18pt7b.h>  // Add a custom font





int Variable1;  // Create a variable to have something dynamic to show on the display






void setup()  // Start of setup
{

  // Display setup:

  // Use this initializer if you're using a 1.8" TFT
  tft.initR(INITR_BLACKTAB);  // Initialize a ST7735S chip, black tab

  tft.fillScreen(ST7735_BLACK);  // Fill screen with black

  //tft.setRotation(0);  // Set orientation of the display. Values are from 0 to 3. If not declared, orientation would be 0,
                         // which is portrait mode.

  tft.setTextWrap(false);  // By default, long lines of text are set to automatically “wrap” back to the leftmost column.
                           // To override this behavior (so text will run off the right side of the display - useful for
                           // scrolling marquee effects), use setTextWrap(false). The normal wrapping behavior is restored
                           // with setTextWrap(true).




  // We are going to print on the display everything that is static on the setup, to leave the loop free for dynamic elements:

  // Write to the display the text "Hello":
  tft.setCursor(0, 0);  // Set position (x,y)
  tft.setTextColor(ST7735_WHITE);  // Set color of text. First is the color of text and after is color of background
  tft.setTextSize(3);  // Set text size. Goes from 0 (the smallest) to 20 (very big)
  tft.println("Hello");  // Print a text or value

  
  
  // Start using a custom font:
  //tft.setFont(&FreeSerif18pt7b);  // Set a custom font
  tft.setTextSize(0);  // Set text size. We are using custom font so you should always set text size as 0

  // Write to the display the text "World":
  tft.setCursor(0, 50);  // Set position (x,y)
  tft.setTextColor(ST7735_RED);  // Set color of text. We are using custom font so there is no background color supported
  tft.println("World!");  // Print a text or value

  // Stop using a custom font:
  //tft.setFont();  // Reset to standard font, to stop using any custom font previously set




  // Draw rectangle:
  tft.drawRect(0, 60, 60, 30, ST7735_CYAN);  // Draw rectangle (x,y,width,height,color)
                                             // It draws from the location to down-right
                                             
  // Draw rounded rectangle:
  tft.drawRoundRect(68, 60, 60, 30, 10, ST7735_CYAN);  // Draw rounded rectangle (x,y,width,height,radius,color)
                                                       // It draws from the location to down-right


  // Draw triangle:
  tft.drawTriangle(60,120,    70,94,    80,120, ST7735_YELLOW);  // Draw triangle (x0,y0,x1,y1,x2,y2,color)


  // Draw filled triangle:
  tft.fillTriangle(100,120,    110,94,    120,120, ST7735_CYAN);  // Draw filled triangle (x0,y0,x1,y1,x2,y2,color)


  // Draw line:
  tft.drawLine(0, 125, 127, 125, ST7735_CYAN);  // Draw line (x0,y0,x1,y1,color)
  

  //  Draw circle:
  tft.drawCircle(15, 144, 14, ST7735_GREEN);  //  Draw circle (x,y,radius,color)


  // Draw a filled circle:
  tft.fillCircle(60, 144, 14, ST7735_BLUE);  // Draw circle (x,y,radius,color)


  // Draw rounded rectangle and fill:
  tft.fillRoundRect(88, 130, 40, 27, 5, 0xF81B);  // Draw rounded filled rectangle (x,y,width,height,color)
  
}  // End of setup







void loop()  // Start of loop
{

  Variable1++;  // Increase variable by 1
  if(Variable1 > 150)  // If Variable1 is greater than 150
  {
    Variable1 = 0;  // Set Variable1 to 0
  }


  // Convert Variable1 into a string, so we can change the text alignment to the right:
  // It can be also used to add or remove decimal numbers.
  char string[10];  // Create a character array of 10 characters
  // Convert float to a string:
  dtostrf(Variable1, 3, 0, string);  // (<variable>,<amount of digits we are going to use>,<amount of decimal digits>,<string name>)







  // We are going to print on the display everything that is dynamic on the loop, to refresh continuously:

  // Write to the display the Variable1 with left text alignment:
  tft.setCursor(13, 67);  // Set position (x,y)
  tft.setTextColor(ST7735_YELLOW, ST7735_BLACK);  // Set color of text. First is the color of text and after is color of background
  tft.setTextSize(2);  // Set text size. Goes from 0 (the smallest) to 20 (very big)
  tft.println(Variable1);  // Print a text or value
  
  // There is a problem when we go, for example, from 100 to 99 because it doesn't automatically write a background on
  // the last digit we are not longer refreshing. We need to check how many digits are and fill the space remaining.
  if(Variable1 < 10)  // If Variable1 is less than 10...
  {
    // Fill the other digit with background color:
    tft.fillRect(23, 67, 12, 18, ST7735_BLACK);  // Draw filled rectangle (x,y,width,height,color)
  }
  if(Variable1 < 100)  // If Variable1 is less than 100...
  {
    // Fill the other digit with background color:
    tft.fillRect(36, 67, 12, 18, ST7735_BLACK);  // Draw filled rectangle (x,y,width,height,color)
  }




  // Write to the display the string with right text alignment:
  tft.setCursor(81, 67);  // Set position (x,y)
  tft.setTextColor(ST7735_GREEN, ST7735_BLACK);  // Set color of text. First is the color of text and after is color of background
  tft.setTextSize(2);  // Set text size. Goes from 0 (the smallest) to 20 (very big)
  tft.println(string);  // Print a text or value








  // We are going to write the Variable1 with a custom text, so you can see the issues:
  
  // Draw a black square in the background to "clear" the previous text:
  // This is because we are going to use a custom font, and that doesn't support brackground color.
  // We are basically printing our own background. This will cause flickering, though.
  tft.fillRect(0, 90, 55, 34, ST7735_BLACK);  // Draw filled rectangle (x,y,width,height,color)




  // Start using a custom font:
  //tft.setFont(&FreeSerif18pt7b);  // Set a custom font
  tft.setTextSize(0);  // Set text size. We are using custom font so you should always set text size as 0

  // Write to the display the Variable1:
  tft.setCursor(0, 120);  // Set position (x,y)
  tft.setTextColor(ST7735_MAGENTA);  // Set color of text. We are using custom font so there is no background color supported
  tft.println(Variable1);  // Print a text or value

  // Stop using a custom font:
 // tft.setFont();  // Reset to standard font, to stop using any custom font previously set





}  // End of loop
  Responder
#17
Buenas noches
he estado bastante liado con el trabajo y no he podido ver estos mensajes antes, lo siento, espero que no sea demasiado tarde aun para daros una respuesta tanto a "Ayuuda", como a "Juguetear", así es que vanos por partes.

Para Ayuuda

el error que te da es porque estas utilizando una librería no valida para esa versión del compilador.

C:\Users\LANIX\Documents\Arduino\libraries\LiquidCrystal_V1.2.1-master\I2CIO.cpp:37:10: fatal error: ../Wire/Wire.h: No such file or directory
#include <../Wire/Wire.h>

Te esta diciendo que la librería "LiquidCrystal_V1.21-master\I2CIO.cpp"
en su línea 37, hace referencia a su vez a la biblioteca "Wire/Wire.h", y que no tienes instalada esta ultima biblioteca, si instalas la biblioteca "Wire.h", posiblemente te compile.

A demás estas incluyendo dos veces la librería "LCD.h", tienes que quitar una de ellas.

Si haces esas dos cosas el programa compila, otra cosa es que haga lo que tu quieres, pero compilar compila.

Un saludo

Ahora para "Jugetar"

Lo primero que te esta diciendo el programa, es que necesitas descargarte estas librerías.

Libraries needed:
https://github.com/adafruit/Adafruit-ST7735-Library
https://github.com/adafruit/Adafruit-GFX-Library


Que mires estas referenciasen el .pdf

Reference page for GFX Library: https://cdn-learn.adafruit.com/downloads...ibrary.pdf

Y que mires esta página

Color is expressed in 16 bit with Hexadecimal value.
To select a particular color, go here and copy the "Hexadecimal 16 bit color depth value":
https://ee-programming-notepad.blogspot....icker.html

Y lo dicho, si instalas las librerías el programa compila

Un saludo
  Responder
#18
Usad la opción de insertar código para que quede mejor y se pueda leer mejor. Visto como un mensaje de texto, se hace un poquito difícil.

Gracias

Código:
void loop()  // Start of loop
{

 Variable1++;  // Increase variable by 1
 if(Variable1 > 150)  // If Variable1 is greater than 150
 {
   Variable1 = 0;  // Set Variable1 to 0
 }


 // Convert Variable1 into a string, so we can change the text alignment to the right:
 // It can be also used to add or remove decimal numbers.
 char string[10];  // Create a character array of 10 characters
 // Convert float to a string:
 dtostrf(Variable1, 3, 0, string);  // (<variable>,<amount of digits we are going to use>,<amount of decimal digits>,<string name>)
-> Mi CNC de escritorio CNCDesktop 500 -> https://www.spainlabs.com/foros/tema-Fresadora-Desktop-CNC-500
-> Laboratorio de Fabricación Digital Maker www.lowpower.io 
--> Twitter: https://twitter.com/Grafisoft_ES  | IG: https://www.instagram.com/lowpowerio/
  Responder
#19
Buenas noches

Gracias Grafisoft, por el recordatorio de las normas del foro, para algo están, procurare que no vuelva a ocurrir.

Un saludo.
  Responder
#20
(23-11-2020, 08:06 PM)asesorplaza1 escribió: Buenas noches

Gracias Grafisoft, por el recordatorio de las normas del foro, para algo están, procurare que no vuelva a ocurrir.

Un saludo.

Nada, si asi se ve un poquito mejor Sonrisa
Saludos,
-> Mi CNC de escritorio CNCDesktop 500 -> https://www.spainlabs.com/foros/tema-Fresadora-Desktop-CNC-500
-> Laboratorio de Fabricación Digital Maker www.lowpower.io 
--> Twitter: https://twitter.com/Grafisoft_ES  | IG: https://www.instagram.com/lowpowerio/
  Responder


Posibles temas similares…
Tema Autor Respuestas Vistas Último mensaje
  DUDA arduino uno + GPS + SD + SDS011 JRRAmirez 1 0 23-07-2023, 04:57 PM
Último mensaje: asesorplaza1
  Como leer ultima linea de la tarjeta SD? Antude 0 694 28-08-2021, 08:41 AM
Último mensaje: Antude
  CONSULTA Error compilando para la tarjeta Arduino Mega or Mega 2560. minaki24fc 2 1,094 26-03-2021, 10:45 PM
Último mensaje: asesorplaza1
  Placa MEGA(china) la reconoce como UNO Jaimelito 1 888 18-11-2020, 10:15 PM
Último mensaje: asesorplaza1
  CONSULTA ¿como uno dos codigos en un solo codigo? laurangcard 1 943 18-11-2020, 10:03 PM
Último mensaje: asesorplaza1