Buenos días!
Estoy usando una placa Arduino UNO para programar mi micro ATM328.
Mi proyecto consiste en ingresar un determinado número por teclado y luego poder enviarlo a través de un emisor RF. Obviamente, hay un LCD como interfaz.
Mientras probaba el proyecto en la plaqueta de arduino UNO, me funcionó siempre correctamente.
Luego hice mi propia plaqueta y ya no me anduvo a la primera.
Y cuando quiero programar el micro me sale el error
avrdude: verification error, first mismatch at byte 0x01c5
0xd1 != 0xc1
Tengo otro micro, con el cual pude programar sin problemas y usarlo correctamente en mi plaqueta, por lo cual creo que el problema no es eléctrico ni mucho menos. ¿Alguno se puede dar una idea del problema?
¡Muchas gracias!
PD: Aquí el código
#include <Keypad.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <RCSwitch.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); //LCD adress
RCSwitch mySwitch = RCSwitch();
unsigned long n=0;
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] = {11, 10, 9, 8}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {7, 6, 5}; //connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
void setup(){
mySwitch.enableTransmit(1); //Transmitter is connected to Arduino Pin #1
mySwitch.setPulseLength(365); //Optional set pulse length.
mySwitch.setProtocol(1); //set protocol (default is 1, will work for most outlets)
lcd.begin(16,2); //Display initialization
}
void loop(){
lcd.setCursor(0,0); //Locate cursor
lcd.write("Ingresar numero");
char key=keypad.getKey(); //Get keypad number
lcd.setCursor(0,1);
if(key){ //If key is pressed, write number on display
if(key!='#'&&key!='*'){ //Write only numbers
n=10*n+(key);
lcd.print(n);
}
}
if(key=='#'){ //Key # is data reset.
n=0;
lcd.setCursor(0,1); //Relocate cursor
lcd.clear(); //Clear display
}
if(key=='*'){ //Send data through RF Tx
lcd.clear();
lcd.setCursor(4,0);
lcd.write("Enviando");
mySwitch.send(n, BIN); //It is sent few times to reassure it'll be received
delay(25);
mySwitch.send(n, BIN);
delay(25);
mySwitch.send(n, BIN);
delay(25);
mySwitch.send(n, BIN);
delay(25);
mySwitch.send(n, BIN);
delay(25);
delay(500); //This delay is for the user to see the message
lcd.setCursor(0,1);
lcd.print(n);
}
}