0

I am having an issue when I try to upload a program to the board. I am working on a Simon Says game, and when I first started uploading, my computer handled it fine. Everything worked properly.

However, now I have added 3 LEDs for the colors and 3 buttons. I wrote a program for them to start the game, and then went to test it. That's when my Arduino would beep 3 times and then 75% of the time my computer would give me this error:

Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

25% of the other time I get this:

An error occurred while uploading the sketch

It seems as though my project is getting too complicated for the Arduino to handle maybe? This is my code:

#include <LiquidCrystal.h>

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

int s = 13; // Speaker
int r = 6;  // Red LED
int y = 5;  // Yellow LED
int g = 4;  // Green LED
int b1 = 3; // Red button
int b2 = 2; // Yellow button
int b3 = 1; // Green button - I don't know if pin 1 works.

void setup() {
  lcd.begin(16, 2);
  pinMode(s, OUTPUT);
  pinMode(r, OUTPUT);
  pinMode(y, OUTPUT);
  pinMode(g, OUTPUT);
  pinMode(b1, INPUT);
  pinMode(b2, INPUT);
  // pinMode(b3, INPUT); Does pin 1 work?
}

void loop() {
  lcd.print("Press any button");
  lcd.setCursor(4, 1);
  lcd.print("to play!");
  while (true) {
    if (digitalRead(b1) == HIGH) {
      break;
    }
    delay(50);
  }
  lcd.clear();
  delay(1000);
  lcd.setCursor(1, 0);
  lcd.print("Simon's turn!");
  delay(1000);
  while (true) {
    // For now, I don't want to loop. I will finish the program when this     problem is resolved.
    delay(50);
  }
}

Does anyone know the solution to this problem?

  • What precisely is wired to pin 1? – Majenko Oct 14 '18 at 16:35
  • Pin 1 goes to the button which goes with the green LED. It can tell when the button is pressed. I didn't know if that was the problem, but when I commented it out, the upload still had an error (not in the code). – Ben Stafford Oct 14 '18 at 16:39
  • Anything besides the button? Any pullup or pulldown resistor? If you disconnect everything from pin 1 does it start working again? – Majenko Oct 14 '18 at 16:39
  • Let me try that. – Ben Stafford Oct 14 '18 at 16:55
  • Okay, I removed everything from pin 1, tried to upload again. Unfortunately, still an error. Also, there is nothing else other than the button. Edit There is a potentiometer, but it doesn't even connect to pin 1. It is for the LCD display adjustment. – Ben Stafford Oct 14 '18 at 16:56
0

Arduino play around from time to time. Which one do you use.

Unplug it and plug it back in. If Pin D0 and D1 are occupied, you may have problems with uploading.

  • I use the Uno. I have unplugged and plugged back in, that didn't affect anything. Pin D0 and D1 are not occupied. Any more suggestions? – Ben Stafford Oct 14 '18 at 16:54
  • Something is blocking the port. It is not a compiler error. – Luke Lozowski Oct 14 '18 at 17:22
  • Can you upload other scripts. Or is it only happen on this one? – Luke Lozowski Oct 14 '18 at 17:23
  • It only happens with this one, which is strange. I've started a new file and it works fine. – Ben Stafford Oct 16 '18 at 21:31
  • Hi Ben. Sorry. I was a little bit busy. I am glad you resolve your problem by creating a new file. I work in IT Support. I also like to know why something is causing the problems. I may have a look at it at some point. Sorry. Just very busy now, with my Arduino projects. I may come across a similar problem and then I will post the answer here. – Luke Lozowski Oct 17 '18 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.