facing problem to upload 2 sketches seperatly

Hi....can anyone help me m facing problem to upload to 2 different sketches on arduino uno...tried to upload 1st sketch it runs perfectly...but another sketch uploaded.....the sketch doesn't work neither the 1st sketch works......plz help m in big trouble......thanks in advance......

you can't have more than one sketch on the arduino at once, for that to happen you would have to write an interpreter and save your sketch as more of a script like bash (shell) or make a boot-loader that can run a script from the atmega chip and also run scripts from an sd card using an sd card shield.

I'm sure it would be easy for someone who can make boot-loaders for this stuff but for us average* people it is to hard. Why would someone make that feature for arduino when they could just use an intel based machine and have true multitasking anyway?

all techs aside, you could put both your scripts into separate functions and call both functions from within the loop of one big script.

As Aaron_1 says, the second sketch overwrites the first one, so that's why the first one stops working: it's not there anymore.

But if your second sketch isn't working, then there's something wrong with it: that problem will have nothing to do with the first one which is history.

If you want to have two programs running, you can't, but you can try to consolidate into one sketch. Don't forget that loop() runs very very quickly, so it's often possible to have lots of things happening sequentially to give the impression of them all happening "at once". This thread of Robin2 may help.

This demo about merging programs may also be useful.

...R