Go Down

Topic: Clear Program before making new circuit (Read 472 times) previous topic - next topic

Biddie

I can not find a way to clear my UNO :(  I have worked with micro controllers before and this is always the first thing to do before wiring up a new circuit. I have searched the subject and it appears, against all reasonable logic, that one just builds a new circuit, then connect the power, which loads the previous circuit program. How can this not immediately destroy everything?
Maybe I just am not understanding the most fundamental things here.
I just received my UNO today and have the blink program running. I created a new sketch with nothing entered, clicked upload, but that does not clear it.
So, if it is true that one just creates any circuit and powers it up with any program, that does not fry it, please explain why it does not destroy it. If there is a way to clear first, please post the sketch.
Stuck at the plate for now, what do I do?

ThatGuy007

I'm not an expert, but i typically upload the new code, then build the circuit, then power the microcontroller. I've never come across a way to clear it, but im certain there is one. Hopefully someone else can answer the question more specifically.

CrossRoads

#2
Feb 20, 2014, 08:28 pm Last Edit: Feb 20, 2014, 09:19 pm by CrossRoads Reason: 1
You can just load a simple code, like blink.
Or a sketch that does nothing, part will power up with all IO as inputs:

void setup (){
while(1); // gets here & just sits ...
}
void loop (){}

[edit - mis-named function corrected]
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Biddie

ty all for fast reply, CrossRoads post worked, but changed void sketch to void setup for those who may run across this thread. Now off to first base :)

CrossRoads

Thanks, little too much on the mind today ...
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

UKHeliBob

Why bother to write your own ?
The IDE  comes with a program that does nothing apart from running the empty loop() function.  No input, output, voltages on pins etc  Look at the BareMinimum example.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

lar3ry


Why bother to write your own ?
The IDE  comes with a program that does nothing apart from running the empty loop() function.  No input, output, voltages on pins etc  Look at the BareMinimum example.


You can get the BareMinimum example by using the IDE's menu. File->New.  It will pop up a new IDE window containing a sketch with a setup() and loop().  Upload that, and build your circuit. Rename it by using File->Save As.
There are 10 kinds of people in the world,
those who understand binary, and those who don't.

UKHeliBob

File/New just gives me a blank edit window here in 1.0.5. What version of the IDE are you using ?
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

lar3ry


File/New just gives me a blank edit window here in 1.0.5. What version of the IDE are you using ?


Interesting. I'm using 1.5.4
There are 10 kinds of people in the world,
those who understand binary, and those who don't.

Go Up