Arduino Yun - Bootloader not retaining sketch on power off

I have a fairly large sketch that I'm trying to run on the Yun. When connected to my machine via USB, I can upload the sketch, the bootloader resets and everything runs as expected.

When I try to run the Yun on an independent power source using the Micro-usb source, the script doesn't run.

However, I am able to upload the Basic Blink sketch and this is retained.

The feedback I get from the Arduino software when trying to upload the problematic sketch doesn't suggest there has been any problems.

Sketch uses 19,740 bytes (68%) of program storage space. Maximum is 28,672 bytes.
Global variables use 845 bytes (33%) of dynamic memory, leaving 1,715 bytes for local variables. Maximum is 2,560 bytes.

The problematic sketch uses a 3rd party library for the DHT22 sensor, HttpClient and Bridge.

Any help would be most welcome, whilst I still have hair left on my head!

32u4 doesn't get erased at power off, so my guesses are 1) your sketch has a while (!Serial); or while (!Console); in the setup, so it's stuck waiting for you to open a serial monitor 2) your sketch tries but fails to start the bridge when the yun is powered on. If that's the case, resetting the 32u4 (white button near the ethernet plug) should suffice

Sorry for the late reply.

Answer 1) was my saviour! Thanks!

danielst-vccp: Sorry for the late reply.

Answer 1) was my saviour! Thanks!

Same problem for me have you found out how to rewrite this scket

raxpa is that a question? can you rephrase it?

It is a question in order to know how danielst-vccp fixed is problem ... I'm working with the same sensor and maybe giving a look to this sketch will help me!