Hew brand new here. Need help with an emergency Project

I have been tasked with fixing an Aduino controled lighting effect for a stage producion. I Wont have acces to the actual prop and new board until tomorrow but i am hoping to get a head start on fixing the issue. I however have never worked with a Arduino anything so I am hoping someone can lend me a hand.

So step one the issue.

From what i have been told the people who regulearly handle the prop have determined that the board has failed after sucessfully working for a very long time. I belive the board is an UNO. A new board has allready been ordered and is on hand.

This new board needs to be programmed though and I have no idea how to do that. At first I was hopeing I could use the IDE appliactaion to simply copy the sketch from the failed board to the new one. But after some reserch it seems that is not nessacerly imposible but its way more complicated than I can attempt to get into as a fresh beginner.

So I am hoping that someone can help me write a sketch that i can fill in the pins on and upload to the new board tomorrow when i have access to it.

the effect is that a momentary switch is used to control 4 LED's. the first push turns LED 1 on, second push turns LED 2 on, third push turns LED 3 on, fourth push turns LED 4 on, fifth push turns All LED's off.

I am hoping that if someone can help me with this first itteration of the Sletch i can use it to temporarally fix the broken prop and than move onto make a better more funtionl effect.

Thanks in advance for any help

The state change detection example may be a place to start. Use the buttonPushCounter variable and a switch case to select which LED is on.

Upload program to Uno.

RyanMcLaughlin:
. I however have never worked with a Arduino anything

the board has failed after sucessfully working for a very long time. I belive the board is an UNO.

Nobody knows any more about what is going on than you do and, while starting over from scratch may not be too hard, it's a bit much to expect that of you with no experience.

You have two problems - the programme, and the connections.

You need to ensure that it is indeed a Uno, and one thing you might consider is what exactly has happened to kill the old one. So look at it closely........

Does the board show signs of abuse? How solidly have the wires to the LEDs been retained? Are they in the right places?

Note that the guts of the Uno is that long black thing with all the legs. It is also the thing that holds the software, and note particularly that it is a solid state device and not easily smashed. Further, one of the purposes of the Uno is to protect it from electrical abuse. This implies that, whatever caused the failure of the board, the actual computer, and the software therein, may be virgo intacto.

What this means is the most obvious solution to programming the new Uno when it arrives is to swap out the main chip for the old one. With a bit of care and a small screwdriver, it is not hard, and may be all that is needed. All that remains then is to be sure that the wires to the LEDs are where the programme expects to find them.

You may well find that the programming is the least of your problems.

Nick_Pyner:
What this means is the most obvious solution to programming the new Uno when it arrives is to swap out the main chip for the old one. With a bit of care and a small screwdriver, it is not hard, and may be all that is needed.

I think that's a good idea but it does assume the Uno uses the socketed ATmega328P. The SMD Unos are also fairly common. Perhaps it's more likely to be the former since it's been around for "a very long time".

Here's what the socketed Uno looks like:

Here's what the SMD Uno looks like:

RyanMcLaughlin:
From what i have been told the people who regulearly handle the prop have determined that the board has failed after sucessfully working for a very long time.

That sounds to me like a person who knows more about this problem than you is expecting you to fix it - which seems silly.

Alternatively, and in my experience a lot more likely, the person has no rational reason for thinking the Uno has failed. Unless there is obvious sign of damage to the existing Uno my first line of enquiry would be to suspect everything EXCEPT the Uno.

A poor connection somewhere or a failed power supply seems the most likely cause of the problem from this distance.

If the Uno has failed, my next line would be to see if you can get hold of a copy of the source code for the program that is on the existing Uno. Who wrote the program?

If you know nothing about programming and Arduinos then writing a program from scratch will be a very steep learning curve and will not be quick.

...R

If it's really an Uno my first check would be the wire connections: those sockets are not the best for long term connection. Just unplugging and replugging can do the job (it clears corrosion in the sockets).

Anyway, I think my general approach will be:

  1. check for loose wires or mechanical failure (damaged/broken parts, snapped wires).
  2. check that the power supply is supplying power to the board. Is the power LED on the board on? If not: power supply issue.
  3. check whether nothing is working, or that part of the peripherals are still working. That's another clue. If part is working, the controller is fine, and likely there are loose wires.
  4. connect the Arduino via USB to the computer. See if it's recognised. See if there's anything appearing on the Serial monitor (if so, the Arduino itself is most likely working just fine).

If it's indeed the Arduino, and the original sketch is not available to you, it's probably time to give up. It's going to take you weeks at best to rewrite the original thing. You have to learn how to program an Arduino, then figure out what is connected where and what signals do things take and provide, and finally figure out what those props have to do so what signals you should provide. A big job for an experienced Arduino person, a nightmare for a beginner that has no idea what even the possibilities are.

Retrieving a program from an Arduino is I think possible, but you end up with the assembler code aka hex file, not the original sketch. This you should be able to upload onto a new Arduino, and the program will work as before.

But indeed it's also important to have an idea of why the thing broke in the first place, or it's bound to happen again.

Although it can't be done via the Arduino IDE, it's really not too difficult to download the program from an Uno and upload it to another one. However, this can only be done if the Uno is in a somewhat functional state. On the other hand, if there is nothing wrong with the Uno then replacing it with another Uno will do nothing since that means the problem lies elsewhere. So that will only be helpful in the chance that something is wrong with the Uno, but not so wrong that you can't download from it.