Arduino R3 no update code

Hello everyone,
I was trying to do a class exam of Arduino but the code was hard, after that the arduino don't upload any new code, i tried to burn bootloader but tha didn't work. Then my Arduino can't do anything (I bought a chinese copy, i was a bit run away of money)

You tell us your Arduino worked until the exam was finished. New code does not upload apparently because your money ran away. I cannot answer with out more information but be sure you get an A on the exam. Try a different cable and a new Arduino and see if the new cable works with both, if so you have a bad cable, if not and it is the same Arduino it is probably bad. But before you run more money check in the tools menu to be sure the appropriate Arduino is chosen.

yes, i tried a different cable and the code upload but the arduino doesn't run the new code, i
got pass the exam but i need repair them or get a new one for continue with homework.

It appears you reached a point where the code will compile but not work. The Arduino does exactly what the code tells it to do. The compiler translates your words to something the Arduino can understand. It is very possible to write code that does not work but will compile.

Go back to ground zero and start with the blink sketch, if you cannot get that to load and work your code does not have a chance. I cannot determine if your problem is the bootloader, your code, or the IDE configured wrong. Check each of those.

i did the blink skecht with the integrated led but that doesn't work at all, for a few seconds could think yes but in the end, doesn't run the program

What happened? Did it Upload? Any errors from the compiler or the IDE? It appears like the Arduino has been fried. Can you post your schematic from when it was working?

I ried to make a player with a buzzer and two buttons with a LCD Display, the last code is below, after this code the arduino couldn't update anymore.

#include <Wire.h>
#include <LiquidCrystal.h>

const int buzzerPin = 3;
const int BUTTON_ZELDA = 2;
const int BUTTON_MARIO = 4;
const int LED_ZELDA = 5;
const int LED_MARIO = 6;

LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

const int melody[] = {
// ... (la melodía que elijas)
};

const char* melodyNames[] = {"Zelda's Lullaby", "Super Mario Bros"};

int currentMelody = 0; // 0 para Zelda, 1 para Mario

void playMelody(const int* melody, int notes, int buzzerPin);
void checkButtons();

void setup() {
lcd.begin(16, 2);
lcd.print("Proyecto Melodias");
delay(2000);
lcd.clear();

pinMode(BUTTON_ZELDA, INPUT_PULLUP);
pinMode(BUTTON_MARIO, INPUT_PULLUP);
pinMode(LED_ZELDA, OUTPUT);
pinMode(LED_MARIO, OUTPUT);
}

void loop() {
checkButtons();
playMelody(melody, sizeof(melody) / sizeof(melody[0]) / 2, buzzerPin);
}

void playMelody(const int* melody, int notes, int buzzerPin) {
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(melodyNames[currentMelody]);

int wholenote = (60000 * 4) / 120; // Tempo 120
int divider, noteDuration;

for (int thisNote = 0; thisNote < notes * 2; thisNote += 2) {
divider = melody[thisNote + 1];
if (divider > 0) {
noteDuration = (wholenote) / divider;
} else if (divider < 0) {
noteDuration = (wholenote) / abs(divider);
noteDuration *= 1.5; // Dotted note
}

tone(buzzerPin, melody[thisNote], noteDuration * 0.9);
delay(noteDuration);
noTone(buzzerPin);

}
}

void checkButtons() {
if (digitalRead(BUTTON_ZELDA) == LOW) {
digitalWrite(LED_ZELDA, HIGH); // Enciende el LED de Zelda
delay(50); // Debounce
currentMelody = 0;
lcd.clear();
} else {
digitalWrite(LED_ZELDA, LOW); // Apaga el LED de Zelda
}

if (digitalRead(BUTTON_MARIO) == LOW) {
digitalWrite(LED_MARIO, HIGH); // Enciende el LED de Mario
delay(50); // Debounce
currentMelody = 1;
lcd.clear();
} else {
digitalWrite(LED_MARIO, LOW); // Apaga el LED de Mario
}
}

If you cannot answer the questions I will help somebody else. Good Luck!

the code upload and the lcd display didn't work well only can see half screen, and the code uploaded with no problem, after that no more code compile

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.