Hola como están? queria ver si algun compañero me puede sacar de dudas tengo un codigo que saque de la red pero es para funcionar en arduino nano,el autor del codigo no responde a unas dudas que tengo(quizas el blog no este activo o lo a dejado morir) la duda es la siguiente,no veo nada en el lcd poniendo los pines como los tiene en el codigo ya e echo varios cambios de cableado y de programacion cambiando los pines y no sale nada,solo lo tipico las barras de la primera linea,yo quiero que se vea en un lcd i2c y en el modo normal (A5,A4),y una pregunta,¿se puede trabajar perfectamente con el arduino uno en vez del arudino nano? se que habra algunos pines que tendre que andar cacharreando pero primero queria solucinar el del lcd.
os dejo el codigo original,os agradesco vuestra colabaración.
#include <SoftwareSerial.h>
#include <Keypad.h>
#define txPin 13 // Pin de Transmision
SoftwareSerial LCD = SoftwareSerial(0, txPin); // since the LCD does not send data back to the Arduino, we should only define the txPin
const int LCDdelay=10; // conservative, 2 actually works
const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] =
{
{'1','2','3'},
{'4','5','6'},
{'7','8','9'},
{'*','0','#'}
};
byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
const int passwordLength = 6; // Definimos cuantos digitos queremos que tenga nuestra contraseña
int currentLength = 0; // Define que numero de la contraseña estamos escribiendo actualmente sobre el teclado
char password[passwordLength]; // Almacena la contraseña o codigo de ACTIVACION/DESACTIVACION
char codIntro[passwordLength]; // Almacena los valores de los códigos introducidos
int i = 0;
int j = 0;
int delayCountDown = 800;
char entered[5]; // Almacena el codigo introducido por el teclado para compararlo con el almacenado en password[5]
char horas[2]; // Definimos buffer las HORAS
char minutos[2]; // Definimos buffer los MINUTOS
char segundos[2]; // Definimos buffer los SEGUNDOS
unsigned int horasTotal; // Definimos las HORAS
unsigned int minutosTotal; // Definimos los MINUTOS
unsigned int segundosTotal; // Definimos los SEGUNDOS
int bufferTiempo[3];
int intentos = 5;
int posicion = 5;
int countPos = 0;
int cables[5] = {1,1,1,1,1};
const int digitosLenght = 2; // Definimos que longitud tienen que debe tener cada HORA, cada MINUTO y cada SEGUNDOS. HORA: 00(2) MINUTO: 00(2) SEGUNDO: 00(2)
const int maxDigitosTiempo = 6; // Definimos la longitud total que tener las HORAS, MINUTOS y SEGUNDOS. HORA: 00(2) + MINUTO: 00(2) + SEGUNDO: 00(2) = 6
int keySwitch = 0;
void setup()
{
Serial.begin(9600);
pinMode(12, INPUT);
pinMode(11, OUTPUT);
LCD.begin(9600);
clearLCD();
lcdPosition(0,0);
backlightOn();
keypad.addEventListener(keypadEvent); // Add an event listener for this keypad
introduccionJuego();
}
void loop()
{
if(digitalRead(12))
{
switch(keySwitch)
{
case 0 : //tone(11, 440, 500);
introduceTiempoPartida();
convertirDigitosTiempoPartidaInteger();
introduceCodigoActivacion();
keySwitch = 1;
break;
case 1 : comprobarCables();
leerCodigo();
countDown();
ponerTiempo();
ponerPantallaCodigo();
ponerIntentosRestantes();
break;
}
}
else
{
Serial.println("0");
delay(500);
}
}
void comprobarCables()
{
cables[0] = analogRead(0);
cables[1] = analogRead(1);
cables[2] = analogRead(2);
cables[3] = analogRead(3);
cables[4] = analogRead(4);
Serial.print("( ");
Serial.print(cables[0]);
Serial.print(" , ");
Serial.print(cables[1]);
Serial.print(" , ");
Serial.print(cables[2]);
Serial.print(" , ");
Serial.print(cables[3]);
Serial.print(" , ");
Serial.print(cables[4]);
Serial.print(" )");
Serial.println();
if(cables[0]<1015) // AUMENTA VELOCIDAD +4
{
tone(11, 1200, 300);
delay(700);
tone(11, 1200, 300);
delay(700);
delayCountDown=250;
Serial.println("AUMENTA VELOCIDAD +4");
}
if(cables[1]<1015) // PONE LA BOMBA EN NORMALIDAD
{
delayCountDown=1000;
Serial.println("VELOCIDAD NORMAL");
}
if(cables[2]<1015) // SE DETIENE
{
bombaDesactivada();
Serial.println("1");
}
if(cables[3]<1015) // EXPLOTA
{
Serial.println("2");
bombaExplosion();
}
if(cables[4]<1015) // AUMENTA VELOCIDAD +2
{